package attend.dao.attend;

import org.apache.log4j.Logger;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import attend.com.CodeMetrix;
import attend.dao.common.CommonDao;

import exception.BaseException;
import util.DBConnection;

public class AttendDao extends DBConnection {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(AttendDao.class);
	
	private List<HashMap<String, String>> 	list 				= null;		//조회결과를 담는 Collection
	
	private List<HashMap<String,String>>    listAuth            = null;
	
	private List<String>					listCondition		= null;		//DAO로 넘기는 PARAMETERS
	
	private Connection 			con 							= 	null;
	private PreparedStatement 	pstmt 							= 	null;
	private ResultSet 			rs 								= 	null;
	
	private StringBuffer 		sql 	= 	new StringBuffer(); //sql statement
	
	private String				msg		=	null;
	private String				chk_in_msg	=	"";			//출근정보가 있으면 메시지를 남긴다.
	private String				chk_out_msg = 	"";			//퇴근정보가 있으면 메시지를 남긴다.
	private String				yyyymmdd	=	null;		//휴가입력 기준일을 동적으로 가져옴.
	
	private String				etc_emp		=	"";			//입력자비고를 위해 생성
	private String          vaca_in_out_tp  =   null;       //출퇴유형 1/19
	private String              reqInOutTp;       // 요청 I,O
	private int					cnt;	//출근정보가 없으면 0 있으면 1이된다.
	
	private int					rowCount;	//total row count
	private String              reqYyyymmdd;
	private String              req_etc;
	private String              authConfirm;
	private String              changeAttendDo;
	private String              reqYmd;
	
	
	/**
	 * @throws BaseException
	 * @throws SQLException
	 */
	public AttendDao() throws BaseException, SQLException {	}
	
	/**
	 * <pre>
	 * 사원에 대한 월간
	 * 조회된 ROW COUNT
	 * </pre>
	 * @param emp_no	-	사번
	 * @param s_date	-	시작날짜 		1일
	 * @param e_date	-	마지막날짜	31일
	 * @throws BaseException
	 */
	public void countAttendByEmpNo(int emp_no , String s_date , String e_date) throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("			SELECT  COUNT(*)	ROW                                                                                         	\r\n");
			sql.append("			    FROM                                                                                                 			\r\n");
			sql.append("			        (                                                                                                			\r\n");
			sql.append("						SELECT                                                                                      			\r\n");
			sql.append("			                    CONVERT(VARCHAR(10) , CONVERT(SMALLDATETIME , A.IN_OUT_DT),20)		IN_OUT_DT       			\r\n");
			sql.append("			                ,   A.YYYYMMDD                                                                          			\r\n");
			sql.append("			                ,   A.EMP_NO                                                                            			\r\n");
			sql.append("			                ,   SUBSTRING(A.IN_OUT_TIME,1,2) + ':' + SUBSTRING(A.IN_OUT_TIME , 3,2) IN_OUT_TIME     			\r\n");
			sql.append("			                ,   A.REG_IP                                                                            			\r\n");
			sql.append("			                ,   A.IN_OUT_DETAIL                                                                     			\r\n");
			sql.append("							,	C.CD_NM																IN_OUT_DETAIL_NM			\r\n");
			sql.append("			                ,   A.IN_OUT_TP                                                                         			\r\n");
			sql.append("			                ,   A.APPROV_EMP_NO                                                                     			\r\n");
			//sql.append("			                ,   A.CONFIRM_YN                                                                     				\r\n");
			sql.append("			            FROM                                                                                        			\r\n");
			sql.append("			                    TB_ATTEND A JOIN TB_COMM_CD C ON A.IN_OUT_DETAIL = C.CD  AND C.CD <> '0' AND LEN(C.GROUP_CD) > 2                      					\r\n");
			sql.append("			            WHERE                                                                                       			\r\n");
			sql.append("			                    A.IN_OUT_TP = 'I'                                                                   			\r\n");
			sql.append("			                    AND A.EMP_NO = ?   ------------------------                                         			\r\n");
			sql.append("			        ) X                                                                                             			\r\n");
			sql.append("			    INNER JOIN                                                                                          			\r\n");
			sql.append("			        (                                                                                               			\r\n");
			sql.append("			            SELECT                                                                                      			\r\n");
			sql.append("			                    CONVERT(VARCHAR(10) , CONVERT(SMALLDATETIME , A.IN_OUT_DT),20)	IN_OUT_DT           			\r\n");
			sql.append("			                ,   A.YYYYMMDD                                                                          			\r\n");
			sql.append("							,	A.EMP_NO                                                                            			\r\n");
			sql.append("			                ,   SUBSTRING(A.IN_OUT_TIME,1,2) + ':' + SUBSTRING(A.IN_OUT_TIME , 3,2)	IN_OUT_TIME     			\r\n");
			sql.append("			                ,   A.REG_IP                                                                            			\r\n");
			sql.append("			                ,   A.IN_OUT_DETAIL                                                                     			\r\n");
			sql.append("							,	C.CD_NM																IN_OUT_DETAIL_NM			\r\n");
			sql.append("			                ,   A.IN_OUT_TP                                                                         			\r\n");
			sql.append("			            FROM                                                                                        			\r\n");
			sql.append("			                    TB_ATTEND A JOIN TB_COMM_CD C ON A.IN_OUT_DETAIL = C.CD   AND C.CD <> '0' AND LEN(C.GROUP_CD) > 2                     			\r\n");
			sql.append("			            WHERE                                                                                       			\r\n");
			sql.append("			                    A.IN_OUT_TP = 'O'                                                                   			\r\n");
			sql.append("			                    AND A.EMP_NO = ?   ------------------------                                         			\r\n");
			sql.append("			        ) Y                                                                                             			\r\n");
			sql.append("			    ON                                                                                                  			\r\n");
			sql.append("			        X.YYYYMMDD = Y.YYYYMMDD                                                                         			\r\n");
			sql.append("			    AND                                                                                                 			\r\n");
			sql.append("			        X.EMP_NO = Y.EMP_NO                                                                             			\r\n");
			sql.append("			    AND                                                                                                  			\r\n");
			sql.append("			        X.YYYYMMDD	BETWEEN 		? 		AND 			?                                                       \r\n");
			
			System.out.println("======================================\r\n");
			//System.out.println("출력건수\r\n" + sql.toString());
			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			pstmt.setInt(1 , emp_no);				//사번
			pstmt.setInt(2 , emp_no);				//사번
			pstmt.setString(3 , s_date);				//시작 기준일짜
			pstmt.setString(4 , e_date);				//끝 기준일짜
			
			rs		=	pstmt.executeQuery();
			
			while (rs.next()) {
				rowCount	=	rs.getInt("row");
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	/**
	 * 출퇴근 메인페이지 조회 <<쿼리 수정함 2009.12.24 HEEJIN>>
	 * @since 2009/01/16
	 * @param 	emp_no
	 * @param	s_date	-	20090201
	 * @param	e_date	-	20090231
	 * @param 	s_row	-	Start Row
	 * @param 	e_row	-	End	Row
	 * @throws BaseException
	 * @throws SQLException
	 * @since	2009/02/08
	 */
	public void retrieveAttendList(int emp_no , String s_date , String e_date , int s_row , int e_row) throws BaseException {
		
		list = new ArrayList<HashMap<String,String>>();
		
		try {
			
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
			//근태등록_입력자의 근태현황 조회
			sql.append("\r\n").append("			SELECT		Z.ROWNUM                                                                                    			");
			sql.append("\r\n").append("					,	Z.YYYYMMDD                                                                                  			");
			sql.append("\r\n").append("					,   Z.DAYNAME                                                                                  			");
			sql.append("\r\n").append("			        ,   Z.EMP_NO                                                                                    			");
			sql.append("\r\n").append("			        ,   Z.IN_TP                                                                                     			");
			sql.append("\r\n").append("			        ,   Z.IN_DT                                                                                     			");
			sql.append("\r\n").append("			        ,   Z.IN_TIME                                                                                   			");
			sql.append("\r\n").append("			        ,   Z.IN_REG_IP                                                                                 			");
			sql.append("\r\n").append("			        ,   Z.IN_DETAIL                                                                                 			");
			sql.append("\r\n").append("					,	Z.IN_DETAIL_NM                                                                              			");
			sql.append("\r\n").append("			        ,   Z.OUT_TP                                                                                    			");
			sql.append("\r\n").append("			        ,   Z.OUT_DT                                                                                    			");
			sql.append("\r\n").append("			        ,   Z.OUT_TIME                                                                                  			");
			sql.append("\r\n").append("			        ,   Z.OUT_REG_IP                                                                                			");
			sql.append("\r\n").append("			        ,   Z.OUT_DETAIL                                                                                			");
			sql.append("\r\n").append("					,	Z.OUT_DETAIL_NM                                                                             			");
			sql.append("\r\n").append("					,	Z.IN_ETC_MGR                                                                            			");
			sql.append("\r\n").append("					,	Z.OUT_ETC_MGR                                                                            			");
			sql.append("\r\n").append("					,	Z.IN_ETC_MGR_MEMO                                                                            			");
			sql.append("\r\n").append("					,	Z.OUT_ETC_MGR_MEMO                                                                            			");
			sql.append("\r\n").append("			        ,   Z.ADVANTAGE			                                                                   					");
			sql.append("\r\n").append("			        ,   Z.ADVANTAGE_NM			                                                                   				");
			sql.append("\r\n").append("			        ,   Z.IN_APPROV_EMP_NO		                                                                   				");
			sql.append("\r\n").append("			        ,   Z.OUT_APPROV_EMP_NO			                                                                   				");
			sql.append("\r\n").append("			        ,   Z.IN_APPROV_EMP_NM			                                                                   				");
			sql.append("\r\n").append("			        ,   Z.OUT_APPROV_EMP_NM			                                                                   				");
			//sql.append("\r\n").append("			        ,	CASE WHEN (APPROV_EMP_NO = APPROV_EMP_NO2) AND (CONFIRM_YN = CONFIRM_YN2) THEN Z.APPROV_EMP_NO ELSE NULL END  AS APPROV_EMP_NO	");
			//sql.append("\r\n").append("			        ,	CASE WHEN (APPROV_EMP_NO = APPROV_EMP_NO2) AND (CONFIRM_YN = CONFIRM_YN2) THEN V.EMP_NM ELSE NULL END  AS APPROV_EMP_NM			");
			sql.append("\r\n").append("			        ,	CASE WHEN (APPROV_EMP_NO = IN_APPROV_EMP_NO) AND (CONFIRM_YN = CONFIRM_YN2) THEN Z.CONFIRM_YN ELSE NULL END  AS CONFIRM_YN		");
			sql.append("\r\n").append("			FROM                                                                                                    			");
			sql.append("\r\n").append("			(                                                                                                       			");
			sql.append("\r\n").append("			SELECT  ROW_NUMBER() OVER(ORDER BY X.YYYYMMDD DESC)         ROWNUM                                      			");
			sql.append("\r\n").append("					,	X.YYYYMMDD                                                                                  			");
			//sql.append("\r\n").append("			        ,   DATENAME(DW , CONVERT(SMALLDATETIME , X.YYYYMMDD)) AS DAYNAME	                    					");
			sql.append("\r\n").append("			        ,   SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , X.YYYYMMDD) ) ,1 ,1) AS  DAYNAME	                    ");
			sql.append("\r\n").append("			        ,   X.EMP_NO                                                                                    			");
			sql.append("\r\n").append("			        ,   X.IN_OUT_TP              in_tp                                                              			");
			sql.append("\r\n").append("			        ,   X.IN_OUT_DT				IN_DT                                                               			");
			sql.append("\r\n").append("			        ,   X.IN_OUT_TIME			IN_TIME                                                             			");
			sql.append("\r\n").append("			        ,   X.REG_IP				IN_REG_IP                                                           			");
			sql.append("\r\n").append("			        ,   X.IN_OUT_DETAIL			IN_DETAIL                                                           			");
			sql.append("\r\n").append("					,	X.IN_OUT_DETAIL_NM		IN_DETAIL_NM                                                        			");
			sql.append("\r\n").append("			        ,   Y.IN_OUT_TP              out_tp                                                             			");
			sql.append("\r\n").append("			        ,   Y.IN_OUT_DT				OUT_DT                                                              			");
			sql.append("\r\n").append("			        ,   Y.IN_OUT_TIME			OUT_TIME                                                            			");
			sql.append("\r\n").append("			        ,   Y.REG_IP				OUT_REG_IP                                                          			");
			sql.append("\r\n").append("			        ,   Y.IN_OUT_DETAIL			OUT_DETAIL                                                          			");
			sql.append("\r\n").append("					,	Y.IN_OUT_DETAIL_NM		OUT_DETAIL_NM                                                       			");
			sql.append("\r\n").append("			        ,   X.APPROV_EMP_NO                                                                             			");
			sql.append("\r\n").append("			        ,   X.CONFIRM_YN                                                                             				");
			sql.append("\r\n").append("			        ,   Y.ADVANTAGE                                                                             				");
			sql.append("\r\n").append("			        ,   Y.ADVANTAGE_NM                                                                             				");
			sql.append("\r\n").append("					,	X.ETC_MGR		        IN_ETC_MGR                                                        			    ");			
			sql.append("\r\n").append("					,	SUBSTRING(X.ETC_MGR , 1 , 5) AS IN_ETC_MGR_MEMO 	 													");			
			sql.append("\r\n").append("					,	Y.ETC_MGR		        OUT_ETC_MGR                                                        			    ");
			sql.append("\r\n").append("					,	SUBSTRING(Y.ETC_MGR , 1 , 5) AS OUT_ETC_MGR_MEMO 																											");
			sql.append("\r\n").append("			        ,	Y.APPROV_EMP_NO AS APPROV_EMP_NO2	,Y.CONFIRM_YN AS CONFIRM_YN2                           			    ");
			sql.append("\r\n").append("			        ,	X.APPROV_EMP_NO AS IN_APPROV_EMP_NO		                     				");
			sql.append("\r\n").append("			        ,	Y.APPROV_EMP_NO AS OUT_APPROV_EMP_NO		                     				");
			sql.append("\r\n").append("			        ,	(select  emp_nm from tb_emp where emp_no = X.APPROV_EMP_NO ) as IN_APPROV_EMP_NM                        				");
			sql.append("\r\n").append("			        ,	(select  emp_nm from tb_emp where emp_no = Y.APPROV_EMP_NO ) as OUT_APPROV_EMP_NM                         				");

			sql.append("\r\n").append("			    FROM                                                                                                			");
			sql.append("\r\n").append("			        (		                                                                                        			");
			sql.append("\r\n").append("						SELECT                                                                                      			");
			//sql.append("\r\n").append("			                    CONVERT(VARCHAR(10) , CONVERT(SMALLDATETIME , A.IN_OUT_DT),20)		IN_OUT_DT       			");
			sql.append("\r\n").append("			                    SUBSTRING(A.IN_OUT_DT,5,2) + '/' + SUBSTRING(A.IN_OUT_DT,7,2) IN_OUT_DT                      ");
			sql.append("\r\n").append("			                ,   A.YYYYMMDD                                                                          			");
			sql.append("\r\n").append("			                ,   A.EMP_NO                                                                            			");
			sql.append("\r\n").append("			                ,   SUBSTRING(A.IN_OUT_TIME,1,2) + ':' + SUBSTRING(A.IN_OUT_TIME , 3,2) IN_OUT_TIME     			");
			sql.append("\r\n").append("			                ,   A.REG_IP                                                                            			");
			sql.append("\r\n").append("			                ,   A.IN_OUT_DETAIL                                                                     			");
			sql.append("\r\n").append("							,	C.CD_NM																IN_OUT_DETAIL_NM			");
			sql.append("\r\n").append("			                ,   A.IN_OUT_TP                                                                         			");
			sql.append("\r\n").append("			                ,   A.APPROV_EMP_NO                                                                     			");
			sql.append("\r\n").append("			                ,   A.CONFIRM_YN                                                                     				");
			sql.append("\r\n").append("			                ,   A.ETC_MGR                                                                    				");
			sql.append("\r\n").append("			            FROM                                                                                        			");
			sql.append("\r\n").append("			                    TB_ATTEND A JOIN TB_COMM_CD C ON A.IN_OUT_DETAIL = C.CD  AND C.CD <> '0' AND LEN(C.GROUP_CD) > 2                      			");
			sql.append("\r\n").append("			            WHERE                                                                                       			");
			sql.append("\r\n").append("			                    A.IN_OUT_TP = 'I'                                                                   			");
			sql.append("\r\n").append("			                    AND A.EMP_NO = ?   ------------------------                                         			");
			sql.append("\r\n").append("			        ) X                                                                                             			");
			sql.append("\r\n").append("			    INNER JOIN                                                                                          			");
			sql.append("\r\n").append("			        (                                                                                               			");
			sql.append("\r\n").append("			            SELECT                                                                                      			");
			//sql.append("\r\n").append("			                    CONVERT(VARCHAR(10) , CONVERT(SMALLDATETIME , A.IN_OUT_DT),20)	IN_OUT_DT           			");
			sql.append("\r\n").append("			                    SUBSTRING(A.IN_OUT_DT,5,2) + '/' + SUBSTRING(A.IN_OUT_DT,7,2) IN_OUT_DT                      ");
			sql.append("\r\n").append("			                ,   A.YYYYMMDD                                                                          			");
			sql.append("\r\n").append("							,	A.EMP_NO                                                                            			");
			sql.append("\r\n").append("			                ,   SUBSTRING(A.IN_OUT_TIME,1,2) + ':' + SUBSTRING(A.IN_OUT_TIME , 3,2)	IN_OUT_TIME     			");
			sql.append("\r\n").append("			                ,   A.REG_IP                                                                            			");
			sql.append("\r\n").append("			                ,   A.IN_OUT_DETAIL                                                                     			");
			sql.append("\r\n").append("							,	C.CD_NM																IN_OUT_DETAIL_NM			");
			sql.append("\r\n").append("			                ,   A.IN_OUT_TP                                                                         			");
			sql.append("\r\n").append("			                ,   A.ADVANTAGE                                                                        				");
			sql.append("\r\n").append("			                ,   C1.CD_NM AS ADVANTAGE_NM    																	");
			sql.append("\r\n").append("			                ,	A.APPROV_EMP_NO		,A.CONFIRM_YN																");
			sql.append("\r\n").append("			                ,   A.ETC_MGR                                                                    				");
			sql.append("\r\n").append("			            FROM                                                                                        			");
			sql.append("\r\n").append("			                    TB_ATTEND A JOIN TB_COMM_CD C ON A.IN_OUT_DETAIL = C.CD  AND C.CD <> '0' AND LEN(C.GROUP_CD) > 2                      			");
			sql.append("\r\n").append("			                    		LEFT JOIN TB_COMM_CD C1 ON A.ADVANTAGE = C1.CD      -- 특근 추가휴가	                    ");
			sql.append("\r\n").append("			            WHERE                                                                                       			");
			sql.append("\r\n").append("			                    A.IN_OUT_TP = 'O'                                                                   			");
			sql.append("\r\n").append("			                    AND A.EMP_NO = ?   ------------------------                                         			");
			sql.append("\r\n").append("			        ) Y                                                                                             			");
			sql.append("\r\n").append("			    ON                                                                                                  			");
			sql.append("\r\n").append("			        X.YYYYMMDD = Y.YYYYMMDD                                                                         			");
			sql.append("\r\n").append("			    AND                                                                                                 			");
			sql.append("\r\n").append("			        X.EMP_NO = Y.EMP_NO                                                                             			");
			sql.append("\r\n").append("			    AND                                                                                                  			");
			sql.append("\r\n").append("			        X.YYYYMMDD	BETWEEN 		? 		AND 			?                                                       ");
			sql.append("\r\n").append("			)   Z   LEFT  JOIN 				TB_EMP V 	ON 		Z.APPROV_EMP_NO =  V.EMP_NO                             ");
			sql.append("\r\n").append("			WHERE Z.ROWNUM	BETWEEN		?	AND		?                                                               			");

			
//			System.out.println("======================================\r\n");
//			System.out.println("쿼리실행 내용\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			logger.info("////////////////////////////////////////////////////////////////////////////////////");
			logger.info(sql.toString());
			logger.info("////////////////////////////////////////////////////////////////////////////////////");

			pstmt 	= con.prepareStatement(sql.toString());
			
			int	idx	=	1;
			pstmt.setInt(idx++ , emp_no);				//사번
			pstmt.setInt(idx++ , emp_no);				//사번
			
			pstmt.setString(idx++, s_date);
			pstmt.setString(idx++, e_date);
			
			pstmt.setInt(idx++ , s_row);				//
			pstmt.setInt(idx++ , e_row);				//
			
			rs 		= pstmt.executeQuery();
			
			while (rs.next()) {
//				각 행의 각각컬럼의 데이터를 담는다.
				HashMap<String , String>  hash_map = new HashMap<String, String>();
				
				hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
				
				//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
				hash_map.put("yyyymmdd" 			, rs.getString("YYYYMMDD") );		//기준일자
				hash_map.put("dayname" 				, rs.getString("DAYNAME") );		//요일
				hash_map.put("in_dt"				, rs.getString("IN_DT") );			//출근날짜
				hash_map.put("in_time"				, rs.getString("IN_TIME") );		//출근시간
				hash_map.put("in_reg_ip"			, rs.getString("IN_REG_IP") );		//출근IP
				hash_map.put("in_detail"			, rs.getString("IN_DETAIL") );		//출근상세
				hash_map.put("in_detail_nm"			, rs.getString("IN_DETAIL_NM") );	//출근상세
				hash_map.put("in_etc_mgr"			, rs.getString("IN_ETC_MGR") );	    //출근확인자비고
				hash_map.put("in_etc_mgr_memo"			, rs.getString("IN_ETC_MGR_MEMO") );	    //출근확인자비고
				hash_map.put("in_approv_emp_no"		, rs.getString("IN_APPROV_EMP_NO") );	//출근확인자사번
				hash_map.put("in_approv_emp_nm"		, rs.getString("IN_APPROV_EMP_NM") );	//출근확인자명
				hash_map.put("out_dt"				, rs.getString("OUT_DT") );			//퇴근날짜
				hash_map.put("out_time"				, rs.getString("OUT_TIME") );		//퇴근시간
				hash_map.put("out_reg_ip"			, rs.getString("OUT_REG_IP") );		//퇴근IP
				hash_map.put("out_detail"			, rs.getString("OUT_DETAIL") );		//퇴근상세
				hash_map.put("out_detail_nm"		, rs.getString("OUT_DETAIL_NM") );	//퇴근상세
				hash_map.put("out_etc_mgr"			, rs.getString("OUT_ETC_MGR") );	    //퇴근확인자비고
				hash_map.put("out_etc_mgr_memo"			, rs.getString("OUT_ETC_MGR_MEMO") );	    //퇴근확인자비고
				hash_map.put("out_approv_emp_no"		, rs.getString("OUT_APPROV_EMP_NO") );	//확인자 사번
				hash_map.put("out_approv_emp_nm"		, rs.getString("OUT_APPROV_EMP_NM") );	//퇴근확인자명
				hash_map.put("confirm_yn"			, rs.getString("CONFIRM_YN") );		//확인자 승인여부
				hash_map.put("advantage"			, rs.getString("ADVANTAGE") );		//
				hash_map.put("advantage_nm"			, rs.getString("ADVANTAGE_NM") );	//
				//hash_map.put("approv_emp_nm"		, rs.getString("APPROV_EMP_NM") );	

				list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			}
    	
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * 출퇴근 메인페이지 조회
	 * @since 2009/01/16
	 * @param 	emp_no
	 * @param	s_date	-	20090201
	 * @param	e_date	-	20090231
	 * @param 	s_row	-	Start Row
	 * @param 	e_row	-	End	Row
	 * @throws BaseException
	 * @throws SQLException
	 * @since	2009/02/08
	 */
	/*public void retrieveAttendList(int emp_no , String s_date , String e_date , int s_row , int e_row) throws BaseException {
		
		list = new ArrayList<HashMap<String,String>>();
		
		try {
			
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
			//근태등록_입력자의 근태현황 조회
			sql.append("\r\n").append("			SELECT		Z.ROWNUM                                                                                    			");
			sql.append("\r\n").append("					,	Z.YYYYMMDD                                                                                  			");
			sql.append("\r\n").append("					,   Z.DAYNAME                                                                                  			");
			sql.append("\r\n").append("			        ,   Z.EMP_NO                                                                                    			");
			sql.append("\r\n").append("			        ,   Z.IN_TP                                                                                     			");
			sql.append("\r\n").append("			        ,   Z.IN_DT                                                                                     			");
			sql.append("\r\n").append("			        ,   Z.IN_TIME                                                                                   			");
			sql.append("\r\n").append("			        ,   Z.IN_REG_IP                                                                                 			");
			sql.append("\r\n").append("			        ,   Z.IN_DETAIL                                                                                 			");
			sql.append("\r\n").append("					,	Z.IN_DETAIL_NM                                                                              			");
			sql.append("\r\n").append("			        ,   Z.OUT_TP                                                                                    			");
			sql.append("\r\n").append("			        ,   Z.OUT_DT                                                                                    			");
			sql.append("\r\n").append("			        ,   Z.OUT_TIME                                                                                  			");
			sql.append("\r\n").append("			        ,   Z.OUT_REG_IP                                                                                			");
			sql.append("\r\n").append("			        ,   Z.OUT_DETAIL                                                                                			");
			sql.append("\r\n").append("					,	Z.OUT_DETAIL_NM                                                                             			");
			sql.append("\r\n").append("			        ,   Z.ADVANTAGE			                                                                   					");
			sql.append("\r\n").append("			        ,   Z.ADVANTAGE_NM			                                                                   				");
			sql.append("\r\n").append("			        ,	CASE WHEN (APPROV_EMP_NO = APPROV_EMP_NO2) AND (CONFIRM_YN = CONFIRM_YN2) THEN Z.APPROV_EMP_NO ELSE NULL END  AS APPROV_EMP_NO	");
			sql.append("\r\n").append("			        ,	CASE WHEN (APPROV_EMP_NO = APPROV_EMP_NO2) AND (CONFIRM_YN = CONFIRM_YN2) THEN V.EMP_NM ELSE NULL END  AS APPROV_EMP_NM			");
			sql.append("\r\n").append("			        ,	CASE WHEN (APPROV_EMP_NO = APPROV_EMP_NO2) AND (CONFIRM_YN = CONFIRM_YN2) THEN Z.CONFIRM_YN ELSE NULL END  AS CONFIRM_YN		");
			sql.append("\r\n").append("			FROM                                                                                                    			");
			sql.append("\r\n").append("			(                                                                                                       			");
			sql.append("\r\n").append("			SELECT  ROW_NUMBER() OVER(ORDER BY X.YYYYMMDD DESC)         ROWNUM                                      			");
			sql.append("\r\n").append("					,	X.YYYYMMDD                                                                                  			");
			sql.append("\r\n").append("			        ,   DATENAME(DW , CONVERT(SMALLDATETIME , X.YYYYMMDD)) AS DAYNAME	                    					");
			sql.append("\r\n").append("			        ,   X.EMP_NO                                                                                    			");
			sql.append("\r\n").append("			        ,   X.IN_OUT_TP              in_tp                                                              			");
			sql.append("\r\n").append("			        ,   X.IN_OUT_DT				IN_DT                                                               			");
			sql.append("\r\n").append("			        ,   X.IN_OUT_TIME			IN_TIME                                                             			");
			sql.append("\r\n").append("			        ,   X.REG_IP				IN_REG_IP                                                           			");
			sql.append("\r\n").append("			        ,   X.IN_OUT_DETAIL			IN_DETAIL                                                           			");
			sql.append("\r\n").append("					,	X.IN_OUT_DETAIL_NM		IN_DETAIL_NM                                                        			");
			sql.append("\r\n").append("			        ,   Y.IN_OUT_TP              out_tp                                                             			");
			sql.append("\r\n").append("			        ,   Y.IN_OUT_DT				OUT_DT                                                              			");
			sql.append("\r\n").append("			        ,   Y.IN_OUT_TIME			OUT_TIME                                                            			");
			sql.append("\r\n").append("			        ,   Y.REG_IP				OUT_REG_IP                                                          			");
			sql.append("\r\n").append("			        ,   Y.IN_OUT_DETAIL			OUT_DETAIL                                                          			");
			sql.append("\r\n").append("					,	Y.IN_OUT_DETAIL_NM		OUT_DETAIL_NM                                                       			");
			sql.append("\r\n").append("			        ,   X.APPROV_EMP_NO                                                                             			");
			sql.append("\r\n").append("			        ,   X.CONFIRM_YN                                                                             				");
			sql.append("\r\n").append("			        ,   Y.ADVANTAGE                                                                             				");
			sql.append("\r\n").append("			        ,   Y.ADVANTAGE_NM                                                                             				");
			sql.append("\r\n").append("			        ,	Y.APPROV_EMP_NO AS APPROV_EMP_NO2	,Y.CONFIRM_YN AS CONFIRM_YN2                           				");
			sql.append("\r\n").append("			    FROM                                                                                                			");
			sql.append("\r\n").append("			        (		                                                                                        			");
			sql.append("\r\n").append("						SELECT                                                                                      			");
			sql.append("\r\n").append("			                    CONVERT(VARCHAR(10) , CONVERT(SMALLDATETIME , A.IN_OUT_DT),20)		IN_OUT_DT       			");
			sql.append("\r\n").append("			                ,   A.YYYYMMDD                                                                          			");
			sql.append("\r\n").append("			                ,   A.EMP_NO                                                                            			");
			sql.append("\r\n").append("			                ,   SUBSTRING(A.IN_OUT_TIME,1,2) + ':' + SUBSTRING(A.IN_OUT_TIME , 3,2) IN_OUT_TIME     			");
			sql.append("\r\n").append("			                ,   A.REG_IP                                                                            			");
			sql.append("\r\n").append("			                ,   A.IN_OUT_DETAIL                                                                     			");
			sql.append("\r\n").append("							,	C.CD_NM																IN_OUT_DETAIL_NM			");
			sql.append("\r\n").append("			                ,   A.IN_OUT_TP                                                                         			");
			sql.append("\r\n").append("			                ,   A.APPROV_EMP_NO                                                                     			");
			sql.append("\r\n").append("			                ,   A.CONFIRM_YN                                                                     				");
			sql.append("\r\n").append("			            FROM                                                                                        			");
			sql.append("\r\n").append("			                    TB_ATTEND A JOIN TB_COMM_CD C ON A.IN_OUT_DETAIL = C.CD  AND C.CD <> '0' AND LEN(C.GROUP_CD) > 2                      			");
			sql.append("\r\n").append("			            WHERE                                                                                       			");
			sql.append("\r\n").append("			                    A.IN_OUT_TP = 'I'                                                                   			");
			sql.append("\r\n").append("			                    AND A.EMP_NO = ?   ------------------------                                         			");
			sql.append("\r\n").append("			        ) X                                                                                             			");
			sql.append("\r\n").append("			    INNER JOIN                                                                                          			");
			sql.append("\r\n").append("			        (                                                                                               			");
			sql.append("\r\n").append("			            SELECT                                                                                      			");
			sql.append("\r\n").append("			                    CONVERT(VARCHAR(10) , CONVERT(SMALLDATETIME , A.IN_OUT_DT),20)	IN_OUT_DT           			");
			sql.append("\r\n").append("			                ,   A.YYYYMMDD                                                                          			");
			sql.append("\r\n").append("							,	A.EMP_NO                                                                            			");
			sql.append("\r\n").append("			                ,   SUBSTRING(A.IN_OUT_TIME,1,2) + ':' + SUBSTRING(A.IN_OUT_TIME , 3,2)	IN_OUT_TIME     			");
			sql.append("\r\n").append("			                ,   A.REG_IP                                                                            			");
			sql.append("\r\n").append("			                ,   A.IN_OUT_DETAIL                                                                     			");
			sql.append("\r\n").append("							,	C.CD_NM																IN_OUT_DETAIL_NM			");
			sql.append("\r\n").append("			                ,   A.IN_OUT_TP                                                                         			");
			sql.append("\r\n").append("			                ,   A.ADVANTAGE                                                                        				");
			sql.append("\r\n").append("			                ,   C1.CD_NM AS ADVANTAGE_NM    																	");
			sql.append("\r\n").append("			                ,	A.APPROV_EMP_NO		,A.CONFIRM_YN																");
			sql.append("\r\n").append("			            FROM                                                                                        			");
			sql.append("\r\n").append("			                    TB_ATTEND A JOIN TB_COMM_CD C ON A.IN_OUT_DETAIL = C.CD  AND C.CD <> '0' AND LEN(C.GROUP_CD) > 2                      			");
			sql.append("\r\n").append("			                    		LEFT JOIN TB_COMM_CD C1 ON A.ADVANTAGE = C1.CD      -- 특근 추가휴가	                    ");
			sql.append("\r\n").append("			            WHERE                                                                                       			");
			sql.append("\r\n").append("			                    A.IN_OUT_TP = 'O'                                                                   			");
			sql.append("\r\n").append("			                    AND A.EMP_NO = ?   ------------------------                                         			");
			sql.append("\r\n").append("			        ) Y                                                                                             			");
			sql.append("\r\n").append("			    ON                                                                                                  			");
			sql.append("\r\n").append("			        X.YYYYMMDD = Y.YYYYMMDD                                                                         			");
			sql.append("\r\n").append("			    AND                                                                                                 			");
			sql.append("\r\n").append("			        X.EMP_NO = Y.EMP_NO                                                                             			");
			sql.append("\r\n").append("			    AND                                                                                                  			");
			sql.append("\r\n").append("			        X.YYYYMMDD	BETWEEN 		? 		AND 			?                                                       ");
			sql.append("\r\n").append("			)   Z   LEFT  JOIN 				TB_EMP V 	ON 		Z.APPROV_EMP_NO =  V.EMP_NO                             ");
			sql.append("\r\n").append("			WHERE Z.ROWNUM	BETWEEN		?	AND		?                                                               			");

			
//			System.out.println("======================================\r\n");
//			System.out.println("쿼리실행 내용\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			logger.info("////////////////////////////////////////////////////////////////////////////////////");
			logger.info(sql.toString());
			logger.info("////////////////////////////////////////////////////////////////////////////////////");

			pstmt 	= con.prepareStatement(sql.toString());
			
			int	idx	=	1;
			pstmt.setInt(idx++ , emp_no);				//사번
			pstmt.setInt(idx++ , emp_no);				//사번
			
			pstmt.setString(idx++, s_date);
			pstmt.setString(idx++, e_date);
			
			pstmt.setInt(idx++ , s_row);				//
			pstmt.setInt(idx++ , e_row);				//
			
			rs 		= pstmt.executeQuery();
			
			while (rs.next()) {
//				각 행의 각각컬럼의 데이터를 담는다.
				HashMap<String , String>  hash_map = new HashMap<String, String>();
				
				hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
				
				//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
				hash_map.put("yyyymmdd" 			, rs.getString("YYYYMMDD") );		//기준일자
				hash_map.put("dayname" 				, rs.getString("DAYNAME") );		//요일
				hash_map.put("in_dt"				, rs.getString("IN_DT") );			//출근날짜
				hash_map.put("in_time"				, rs.getString("IN_TIME") );		//출근시간
				hash_map.put("in_reg_ip"			, rs.getString("IN_REG_IP") );		//출근IP
				hash_map.put("in_detail"			, rs.getString("IN_DETAIL") );		//출근상세
				hash_map.put("in_detail_nm"			, rs.getString("IN_DETAIL_NM") );	//출근상세
				hash_map.put("out_dt"				, rs.getString("OUT_DT") );			//퇴근날짜
				hash_map.put("out_time"				, rs.getString("OUT_TIME") );		//퇴근시간
				hash_map.put("out_reg_ip"			, rs.getString("OUT_REG_IP") );		//퇴근IP
				hash_map.put("out_detail"			, rs.getString("OUT_DETAIL") );		//퇴근상세
				hash_map.put("out_detail_nm"		, rs.getString("OUT_DETAIL_NM") );	//퇴근상세
				hash_map.put("approv_emp_no"		, rs.getString("APPROV_EMP_NO") );	//확인자 사번 
				hash_map.put("approv_emp_nm"		, rs.getString("APPROV_EMP_NM") );	//확인자명
				hash_map.put("confirm_yn"			, rs.getString("CONFIRM_YN") );		//확인자 승인여부
				hash_map.put("advantage"			, rs.getString("ADVANTAGE") );		//
				hash_map.put("advantage_nm"			, rs.getString("ADVANTAGE_NM") );	//

				list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			}
    	
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}*/
	/**
	 * <pre>
	 * 출근 입력 팝업에서 저장 클릭시 출근정보가 입력된다.
	 * </pre>	 * @param yyyymmdd
	 * 
	 * @param check_in_time			--	출근시간
	 * @param ip					--  사용PC IP
	 * @param emp_no				--	사번
	 * @param etc_emp				--	입력자-비고
	 * @param check_in_place		--	출근지 CD
	 * @param check_in_place_nm		--	출근지 CD_NM
	 * @param check_in_type			--	출근 유형
	 * @param check_in_type_nm
	 * @throws BaseException
	 * @throws SQLException
	 */
	public void updateEmpAttendCheckIn(String yyyymmdd , String check_in_time , String ip , int emp_no , String etc_emp , String check_in_place , String check_in_type) throws BaseException , SQLException {
		//debug start
//		System.out.println("check_in_time----------->		"		+ check_in_time		);
//		System.out.println("ip----------->		"					+ ip				);
//		System.out.println("emp_no----------->		"				+ emp_no			);
//		System.out.println("etc_emp----------->		"				+ etc_emp			);
//		System.out.println("check_in_place----------->		"		+ check_in_place	);
//		System.out.println("check_in_type----------->		"		+ check_in_type		);
		//debug start
		System.out.println("출근 타입 : " + check_in_type ); // 20110904 최병옥 추가
		try {
			
			con = super.getDataSource().getConnection();
			
			//출근정보가 입력이 되었을 시 업데이트를 하지 않음.
			
			
			sql.setLength(0);
			
            sql.append("    UPDATE                                                                                            \r\n");
            sql.append("            TB_ATTEND                                                                                 \r\n");
            sql.append("    SET                                                                                               \r\n");
            sql.append("            IN_OUT_DT           =   CONVERT(VARCHAR(8) , GETDATE() , 112)                             \r\n");
            sql.append("        ,   IN_OUT_TIME         =   REPLACE(CONVERT(VARCHAR(6) , GETDATE() , 108) , ':' , '')         \r\n");
            //sql.append("        ,   IN_OUT_TIME         =   '" + check_in_time + "'         										\r\n");
            sql.append("        ,   IN_OUT_DETAIL       =   ?   --COMM_CD ref                                                 \r\n");
            sql.append("        ,   IN_OUT_PLACE        =   ?   --COMM_CD ref                                                 \r\n");
            sql.append("        ,   IN_OUT_PLACE_NM     =   ( SELECT CD_NM	FROM TB_COMM_CD	WHERE CD = ? AND USE_YN = 'Y' )   \r\n");
            sql.append("        ,   ETC_EMP             =   ?   --비고                                                        \r\n");
            sql.append("        ,   REG_IP              =   ?   --IP                                                          \r\n");
            sql.append("    WHERE                                                                                             \r\n");
            sql.append("            YYYYMMDD            =   ?   --기준이자              --?                                   \r\n");
            sql.append("        AND                                                                                           \r\n");
            sql.append("            IN_OUT_TP           =   'I' --I : 출근 / O : 퇴근   --?                                   \r\n");
            sql.append("        AND                                                                                           \r\n");
            sql.append("            EMP_NO              =   ?   --사번                  --?                                   \r\n");
            sql.append("        AND EXISTS(SELECT * FROM TB_ATTEND WHERE YYYYMMDD =?					\r\n");
            sql.append("        AND IN_OUT_DT IS NULL   													\r\n");
            sql.append("        AND EMP_NO		=	?   															\r\n");
            sql.append("        AND IN_OUT_TP	=	'I')   															\r\n");
            
			//System.out.println("쿼리실행 내용\r\n" + sql.toString());

			pstmt 	= con.prepareStatement(sql.toString());
			
			int i = 1;	//index
			
			pstmt.setString(i++, check_in_type);		//출근 유형 cd
			pstmt.setString(i++, check_in_place);		//출근지 유형
			pstmt.setString(i++, check_in_place);	//출근지 상세
			pstmt.setString(i++, etc_emp);			//입력자-비고
			pstmt.setString(i++, ip);					//입력자-IP
			pstmt.setString(i++, yyyymmdd);			//기준일자
			pstmt.setInt(	i++, emp_no);				//사번
			pstmt.setString(i++, yyyymmdd);			//기준일자
			pstmt.setInt(	i++, emp_no);				//사번
			
			int apply_rows = pstmt.executeUpdate();
			
			//Update 정보가 있으면 출력함.
			if (apply_rows > 0) {
				setMsg("출근정보가 입력되었습니다.");
			} else {
				setMsg("출근정보가 이미 입력 되어 \r\n출근입력이 되지 않았습니다.");
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>
	 * 퇴근 입력 팝업에서 저장 클릭시 퇴근정보가 입력된다.
	 * </pre>	 * @param yyyymmdd
	 * 
	 * @param check_in_time			--	퇴근시간
	 * @param ip					--  사용PC IP
	 * @param emp_no				--	사번
	 * @param etc_emp				--	입력자-비고
	 * @param check_in_place		--	퇴근지 CD
	 * @param check_in_place_nm		--	퇴근지 CD_NM
	 * @param check_in_type			--	퇴근 유형
	 * @param check_in_type_nm
	 * @throws BaseException
	 * @throws SQLException
	 */
	public void updateEmpAttendCheckOut(String yyyymmdd , String check_out_time , String ip , int emp_no , String etc_emp , String check_out_place , String check_out_type ) throws BaseException , SQLException {
		//debug start
//		System.out.println("check_in_time-->    "		+ check_out_time		);
//		System.out.println("ip-->    "					+ ip					);
//		System.out.println("emp_no-->    "				+ emp_no				);
//		System.out.println("etc_emp-->    "				+ etc_emp				);
//		System.out.println("check_in_place-->    "		+ check_out_place		);
//		System.out.println("check_in_type-->    "		+ check_out_type		);
		//debug start
		
		System.out.println("퇴근 타입 : " + check_out_type ); // 20110904 최병옥 추가
		System.out.println("퇴근 타입 : " + emp_no ); // 20110904 최병옥 추가
		
		try {
			
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("    UPDATE                                                                                            				\r\n");
			sql.append("            TB_ATTEND                                                                                 				\r\n");
			sql.append("    SET                                                                                               				\r\n");
			sql.append("            IN_OUT_DT           =   CONVERT(VARCHAR(8) , GETDATE() , 112)                             				\r\n");
			sql.append("        ,   IN_OUT_TIME         =   REPLACE(CONVERT(VARCHAR(6) , GETDATE() , 108) , ':' , '')         				\r\n");
			//sql.append("        ,   IN_OUT_TIME         =   '"+ check_out_time +"'         													\r\n");
			sql.append("        ,   IN_OUT_DETAIL       =   ?   --COMM_CD ref                                                 				\r\n");
			sql.append("        ,   IN_OUT_PLACE        =   ?   --COMM_CD ref                                                 				\r\n");
			//sql.append("        ,   IN_OUT_PLACE_NM     =   (SELECT CD FROM TB_COMM_CD WHERE GROUP_CD = '103' AND CD = ? AND USE_YN = 'N')    	\r\n");
			sql.append("        ,   IN_OUT_PLACE_NM     =   (SELECT CD_NM FROM TB_COMM_CD WHERE GROUP_CD = '103' AND CD = ? AND USE_YN = 'Y')    	\r\n"); // 퇴근지 쿼리 오류 수정 2011.09.16 (최병옥)
			sql.append("        ,   ETC_EMP             =   ?   --비고                                                       			 					\r\n");
			sql.append("        ,   REG_IP              =   ?   --IP                                                          				\r\n");
			sql.append("    WHERE                                                                                             	\r\n");
			sql.append("            YYYYMMDD            =   ?   --기준이자              --?                                   \r\n");
			sql.append("        AND                                                                                           \r\n");
			sql.append("            IN_OUT_TP           =   'O' --I : 출근 / O : 퇴근   --?                                   \r\n");
			sql.append("        AND                                                                                           \r\n");
			sql.append("            EMP_NO              =   ?   --사번                  --?                                   \r\n");
			sql.append("        AND EXISTS(SELECT * FROM TB_ATTEND WHERE YYYYMMDD =?					\r\n");
            sql.append("        AND IN_OUT_DT IS NULL   													\r\n");
            sql.append("        AND EMP_NO		=	?   															\r\n");
            sql.append("        AND IN_OUT_TP	=	'O')   															\r\n");
            
//			System.out.println("=================================================================================\r\n");
//			System.out.println("쿼리실행 내용\r\n" + sql.toString());
//			System.out.println("=================================================================================\r\n");
			
			pstmt 	= con.prepareStatement(sql.toString());
			
			int i = 1;	//index
			
			pstmt.setString(i++, check_out_type);		//출근 유형 cd
			pstmt.setString(i++, check_out_place);		//출근지 유형
			pstmt.setString(i++, check_out_place);		//출근지 유형	--쿼리에서 코드를 조회하여 가져온다.
			pstmt.setString(i++, etc_emp);				//입력자-비고
			pstmt.setString(i++, ip);					//입력자-IP
			pstmt.setString(i++, yyyymmdd);				//기준일자
			pstmt.setInt(	i++, emp_no);				//사번
			pstmt.setString(i++, yyyymmdd);			//기준일자
			pstmt.setInt(	i++, emp_no);				//사번
			
			int apply_rows = pstmt.executeUpdate();
			
			//Update 정보가 있으면 출력함.
			if (apply_rows > 0) {
				setMsg("퇴근정보가 입력되었습니다.");
			} else {
				setMsg("퇴근정보가 이미 입력되어\r\n 퇴근입력이 되지 않았습니다.");
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	public void updateChange(String reqYmd,String reqYyyymmdd,String req_etc,String authConfirm,String changeAttendDo,String reqInOutTp,int emp_no) throws BaseException , SQLException {
		//debug start
//		System.out.println("reqYyyymmdd-->    "		+ reqYyyymmdd		);
//		System.out.println("req_etc-->    "					+ req_etc					);
//		System.out.println("authConfirm-->    "				+ authConfirm				);
//		System.out.println("changeAttendDo-->    "				+ changeAttendDo				);
//		System.out.println("reqYmd-->    "				+ reqYmd				);
//		System.out.println("reqInOutTp-->    "				+ reqInOutTp				);
//		System.out.println("emp_no-->"  + emp_no);
		//debug start
		
		try {
		  if(changeAttendDo.equals("2001")||changeAttendDo.equals("2002")||changeAttendDo.equals("2003")||changeAttendDo.equals("2004")){
			  con = super.getDataSource().getConnection();
				
				sql.setLength(0);
				
				sql.append(" UPDATE TB_ATTEND                                             \r\n");
				sql.append(" SET                                                          \r\n");
				sql.append("        REQ_DT = ?                                            \r\n");
				sql.append("       ,REQ_DETAIL = ?                                        \r\n");
				sql.append("       ,REQ_ETC = ?                                           \r\n");
				sql.append("       ,REQ_YN  = 'N'                                         \r\n");
				sql.append("       ,REQ_CONFIRM_EMP = ?                                   \r\n");
				sql.append(" where YYYYMMDD = ?                                           \r\n");
				sql.append("         AND                                                  \r\n");
				sql.append("       IN_OUT_TP IN ('I','O')                                 \r\n");
				sql.append("         AND                                                  \r\n");
				sql.append("       emp_no = ?                                             \r\n");
				
//				System.out.println("=================================================================================\r\n");
				System.out.println("쿼리실행 내용\r\n" + sql.toString());
//				System.out.println("=================================================================================\r\n");
				
				pstmt 	= con.prepareStatement(sql.toString());
				
				int i = 1;	//index
				
				pstmt.setString(i++, reqYyyymmdd);		//출근 유형 cd
				pstmt.setString(i++, changeAttendDo);		//출근지 유형
				pstmt.setString(i++, req_etc);		//출근지 유형	--쿼리에서 코드를 조회하여 가져온다.
				pstmt.setString(i++, authConfirm);				//입력자-비고
				pstmt.setString(i++, reqYmd);				//기준일자
				pstmt.setInt(i++, emp_no);	
	              int apply_rows = pstmt.executeUpdate();
				
				//Update 정보가 있으면 출력함.
				if (apply_rows > 0) {
					setMsg("근태정보수정 정보가 입력되었습니다.");
				} 	  
		  }
		
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
			
			sql.append(" UPDATE TB_ATTEND                                             \r\n");
			sql.append(" SET                                                          \r\n");
			sql.append("        REQ_DT = ?                                            \r\n");
			sql.append("       ,REQ_DETAIL = ?                                        \r\n");
			sql.append("       ,REQ_ETC = ?                                           \r\n");
			sql.append("       ,REQ_YN  = 'N'                                         \r\n");
			sql.append("       ,REQ_CONFIRM_EMP = ?                                   \r\n");
			sql.append(" where YYYYMMDD = ?                                           \r\n");
			sql.append("         AND                                                  \r\n");
			sql.append("       IN_OUT_TP = ?                                          \r\n");
			sql.append("         AND                                                  \r\n");
			sql.append("       emp_no = ?                                             \r\n");
			
//			System.out.println("=================================================================================\r\n");
			System.out.println("쿼리실행 내용\r\n" + sql.toString());
//			System.out.println("=================================================================================\r\n");
			
			pstmt 	= con.prepareStatement(sql.toString());
			
			int i = 1;	//index
			
			pstmt.setString(i++, reqYyyymmdd);		//출근 유형 cd
			pstmt.setString(i++, changeAttendDo);		//출근지 유형
			pstmt.setString(i++, req_etc);		//출근지 유형	--쿼리에서 코드를 조회하여 가져온다.
			pstmt.setString(i++, authConfirm);				//입력자-비고
			pstmt.setString(i++, reqYmd);				//기준일자
			pstmt.setString(i++, reqInOutTp);
			pstmt.setInt(i++, emp_no);	
              int apply_rows = pstmt.executeUpdate();
			
			//Update 정보가 있으면 출력함.
			if (apply_rows > 0) {
				setMsg("근태정보수정 정보가 입력되었습니다.");
			} 
		  
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>
	 * 시간에 따른 출근유형 - List
	 * 09:05 이전 -정상출근
	 * 이후-지각 , 정상출근(현지) , 오전공가 , 오전휴가
	 * 토/일요일 - 공휴일출근 (국경일 미적용 . 차후 적용예정) 
	 * </pre>
	 * @throws BaseException
	 * @throws SQLException
	 */
	public void retrieveCheckInType(int emp_no) throws BaseException , SQLException {
		System.out.println("***********"+emp_no);
		
		try {

			con = super.getDataSource().getConnection();	//근태관리 Connection
			
			CallableStatement call = con.prepareCall("{ call DBO.RETRIEVE_IN_PLACE_BY_TIME( ? ) }");
			call.setInt(	1	, emp_no);
			
			System.out.println("======================================\r\n");
			System.out.println("RETRIEVE_IN_PLACE_BY_TIME 프로시저 실행");
			System.out.println("======================================\r\n");

			rs = call.executeQuery();
			
			list = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
//				각 행의 각각컬럼의 데이터를 담는다.
				HashMap<String , String>  hash_map = new HashMap<String, String>();
				
				//hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
				//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
				hash_map.put("cd" 		, rs.getString("CD") );		//코드 key
				hash_map.put("cd_nm"	, rs.getString("CD_NM") );	//코드명 value
				
				list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			}
    	
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e)
		{
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>
	 * 시간에 따른 퇴근유형 조회
	 * 정상퇴근/조퇴/오후공가/오후휴가/야근/철야/공휴일 퇴근
	 * @since 2009/01/19
	 * </pre>
	 * @throws BaseException
	 * @throws SQLException
	 */
	public void retrieveCheckOutType(String ymd , int emp_no) throws BaseException , SQLException {
		
		try {

			con = super.getDataSource().getConnection();	//근태관리 Connection
			
			CallableStatement call = con.prepareCall("{ call DBO.RETRIEVE_OUT_PLACE_BY_TIME( ? , ? ) }");
			
			call.setString(	1	, ymd);
			call.setInt(	2	, emp_no);
			
			System.out.println("------------------------------------------------------\r\n");
			System.out.println("param1 :    " + ymd);
			System.out.println("param2 :    " + emp_no);
			System.out.println("\n\n");
			System.out.println("------------------------------------------------------\r\n");
			System.out.println("퇴근유형");
			System.out.println("RETRIEVE_OUT_PLACE_BY_TIME 프로시저 실행");
//			System.out.println("기준일자와 EMP_NO parameter로 넘긴다.");
			System.out.println("------------------------------------------------------\r\n");

			rs = call.executeQuery();
			
			list = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
//				각 행의 각각컬럼의 데이터를 담는다.
				HashMap<String , String>  hash_map = new HashMap<String, String>();
				
				//hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
				//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
				hash_map.put("cd" 		, rs.getString("CD") );		//코드 key
				hash_map.put("cd_nm"	, rs.getString("CD_NM") );	//코드명 value
				
				list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			}
    	
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e)
		{
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>출근정보의 출근유형에 맞게 적용함</pre>
	 * @return String - 출근지코드 -
	 * @throws BaseException
	 * @since	2009/02/28
	 */
	public String retrieveCheckInPlaceBy(String yyyymmdd , int emp_no) throws BaseException {
		
		String in_out_tp = "";
		
		try {
			
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
            //출근지 - 본사 = 본사 , 홍대사무실 = 홍대사무실 , 직접입력 = 직접입력
			sql.append("					SELECT 		IN_OUT_PLACE     							\n");
			sql.append("					FROM 		TB_ATTEND        							\n");
			sql.append("					WHERE 		YYYYMMDD 	= 	?							\n");
			sql.append("					AND 		EMP_NO 		= 	?							\n");
			sql.append("					AND 		IN_OUT_TP 	= 	'I'							\n");
			
			System.out.println("======================================\r\n");
			System.out.println("출근정보의 출근유형에 맞게 적용함.\r\n" + sql.toString());
			System.out.println("======================================\r\n");

			pstmt 	= 	con.prepareStatement(sql.toString());
			
			pstmt.setString(1, yyyymmdd);
			pstmt.setInt(2, emp_no);
			
			rs 		= 	pstmt.executeQuery();
			
			if (rs.next()) {
				in_out_tp = rs.getString("IN_OUT_PLACE");
			}
    	
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
		
		return in_out_tp;
	}
	
	/**
	 * <pre>
	 * 출근지 선택
	 * 본사 , 홍대사무실 , 직접입력 등
	 * </pre>
	 * @throws BaseException
	 * @throws SQLException
	 */
	public void retrieveCheckInPlace() throws BaseException {
		
		try {
			//con = DBConnection.getDataSource().getConnection();;
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
            //출근지 - 본사 , 홍대사무실 , 직접입력
            sql.append("    SELECT                          \r\n");
            sql.append("            CD , CD_NM              \r\n");
            sql.append("    FROM                            \r\n");
            sql.append("            TB_COMM_CD              \r\n");
            sql.append("    WHERE                           \r\n");
            sql.append("            GROUP_CD    =   '103'   \r\n");
            sql.append("        AND                         \r\n");
            sql.append("            CD          !=  '0'     \r\n");
            sql.append("        AND                         \r\n");
            sql.append("            USE_YN       =  'Y'     \r\n");
            sql.append("    ORDER BY CD					    \r\n");
			
			System.out.println("======================================\r\n");
			System.out.println("쿼리실행 내용\r\n" + sql.toString());
			System.out.println("======================================\r\n");

			pstmt 	= 	con.prepareStatement(sql.toString());
			rs 		= 	pstmt.executeQuery();
			
			
			list 	= 	new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				
//				각 행의 각각컬럼의 데이터를 담는다.
				HashMap<String , String>  hash_map = new HashMap<String, String>();
				
				//hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
				//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
				hash_map.put("cd" 		, rs.getString("CD") );		//코드 key
				hash_map.put("cd_nm"	, rs.getString("CD_NM") );	//코드명 value
				
				list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			}
    	
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>
	 * 휴가 저장
	 * (전일 휴가)공가  , 특별휴가 , 경조휴가 , 연차휴가 
	 * </pre>
	 * @throws BaseException
	 * @throws SQLException
	 */
//	public void updateVacation(List<String> listCondition , String yyyymmdd) throws BaseException , SQLException {
//		
//		System.out.println(yyyymmdd);
//		
//		System.out.println(listCondition);
//		
//		
//		con = super.getDataSource().getConnection();
//		
//		try {
//			
//			sql.setLength(0);
//
//            sql.append("    UPDATE                                                                                      \r\n");
//            sql.append("            TB_ATTEND                                                                           \r\n");
//            sql.append("    SET                                                                                         \r\n");
//            sql.append("            IN_OUT_DETAIL       =   ?                                                           \r\n");
//            sql.append("        ,   IN_OUT_DT           =   CONVERT(VARCHAR(8) , GETDATE() , 112)                       \r\n");
//            sql.append("        ,   IN_OUT_TIME         =   REPLACE(CONVERT(VARCHAR(6) , GETDATE() , 108) , ':' , '')   \r\n");
//            sql.append("        ,   ETC_EMP             =   ?                                                           \r\n");
//            sql.append("        ,   REG_IP              =   ?                                                           \r\n");
//            sql.append("    WHERE   1   =   1                                                                           \r\n");
//            sql.append("        AND EMP_NO    =    ?                                                                    \r\n");
//            
//            
//            
//            /**************************************************************************/
//			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
//			/**************************************************************************/
//            String[] arrStr = yyyymmdd.split(",");
//            
//    		//잘라서 담는다.
//    		
//    		//갯수에 따라 뽑아지게 된다.
//            for (int i = 0; i < arrStr.length ; i++) {
//    			//SQL에 갯수만큼 추가시킨다.
//            	if (i == 0) {
//            		sql.append("	AND	(						\r\n");
//				} else if ( i > 0) {
//					sql.append("	OR							\r\n");
//				}
//    			
//            	sql.append("        YYYYMMDD            =   ?   \r\n");
//    			
//    			if (i == (arrStr.length - 1) ) {
//    				sql.append("	)	");
//    			}
//    		}
//    		
//            /**************************************************************************/
//            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
//            /**************************************************************************/
//            
//			pstmt 	= 	con.prepareStatement(sql.toString());
//			
//			/**************************************************************************/
//			//P A R A M E T E R		V A L U E S		S T A R T
//			/**************************************************************************/
//			int idx = 1;
//			
//			pstmt.setString(idx++ , listCondition.get(0));	//그룹코드//group_cd
//			pstmt.setString(idx++ , listCondition.get(1));	//그룹코드//group_cd
//			pstmt.setString(idx++ , listCondition.get(2));	//그룹코드//group_cd
//			pstmt.setString(idx++ , listCondition.get(3));	//그룹코드//group_cd
//			
//			//Dynamic Condition에 맞게 돌린다.
//			for (int i = 0; i < arrStr.length ; i++) {
//				pstmt.setString(idx++ , arrStr[i]);	//기준일자 				
//			}
//			
////			System.out.println("------------------------------------------------------\r\n");
////			System.out.println("휴가 입력 - 저장\r\n" + sql.toString());
////			System.out.println("------------------------------------------------------\r\n");
//			
//			idx = 0;	//init
//			
//			/**************************************************************************/
//			//P A R A M E T E R		V A L U E S		E   N   D
//			/**************************************************************************/
//			
//			int i = pstmt.executeUpdate();
//			
//			//출근과 퇴근 2개의 행에 대하여 업데이트하므로 1번 실행시에 2가 리턴 된다.
//			//2개일경우는 4이다. n*2개이다.
//			System.out.println("update return value--------->>>>>>>>>>>>>>>>\r\n" + i);
//			
//			
//			if (i > 1) {
//				//update가 적용된 row가 0 이하인 경우
//				setMsg("휴가정보가 입력되었습니다.");
//			} else {
//				setMsg("휴가 정보가 이미 입력되었거나 \r\n 입력되지 않았습니다.");
//			}
//			
//			System.out.println(msg);
//			
//		} catch (SQLException se) {
//			se.printStackTrace();
//			BaseException dex = new BaseException();                
//			dex.setException(se);
//			dex.setAppReturnCode("10");
//			throw dex;
//		} catch(Exception e) {
//			BaseException dex = new BaseException();                
//			dex.setException(e);
//			dex.setAppReturnCode("20");
//			throw dex;
//		} finally {
//			try {
//				if (pstmt != null) pstmt.close();
//				if (rs != null) rs.close();
//				if(con != null) con.close();
//
//			} catch(SQLException fse) {
//				BaseException dex = new BaseException();                
//				dex.setException(fse);
//				dex.setAppReturnCode("10");
//				throw dex;
//			}          
//		}
//	}
public void updateenter(List<String> listCondition , String yyyymmdd, String vaca_in_out_tp) throws BaseException , SQLException {
		
	   String inout = vaca_in_out_tp.substring(0,1);
	System.out.println("휴가업데이트 기준일자"+yyyymmdd);
		
		System.out.println(listCondition);
		
    System.out.println("updateVacation_vaca_in_out_tp---------->"+vaca_in_out_tp);
	   System.out.println("updateVacation_vaca_in_out_tp---------->"+inout);
	    con = super.getDataSource().getConnection();
	    System.out.println("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW");
	                       
		try {
			
			sql.setLength(0);
			
			sql.append("update TB_ATTEND SET ETC_EMP =? WHERE 1=1 and EMP_NO=? and  IN_OUT_TP= '"+ inout +"'  ");
			
			
			
		 //   sql.append("    UPDATE                                                                                      \r\n");
		//	sql.append("            TB_ATTEND                                                                           \r\n");
		//	sql.append("    SET                                                                                         \r\n");
		//	sql.append("            IN_OUT_DETAIL       =   ?                                                           \r\n");
		 //   sql.append("        ,   IN_OUT_DT           =   CONVERT(VARCHAR(8) , GETDATE() , 112)                       \r\n");
		  //  sql.append("        ,   IN_OUT_TIME         =   REPLACE(CONVERT(VARCHAR(6) , GETDATE() , 108) , ':' , '')   \r\n");
		//	sql.append("        ,   ETC_EMP             =   ?                                                           \r\n");
		//	sql.append("        ,   REG_IP              =   ?                                                           \r\n");
		 //   sql.append("    WHERE   1   =   1                                                                           \r\n");
		//	sql.append("        AND EMP_NO    =    ?                                                                    \r\n");
		//	sql.append("        AND IN_OUT_TP = '"+ inout +"'                                                           \r\n");            
			            
			            
			 /**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
			  String[] arrStr = yyyymmdd.split(",");
			            
			    //잘라서 담는다.
			    		
			    //갯수에 따라 뽑아지게 된다.
			   for (int i = 0; i < arrStr.length ; i++) {
			    	//SQL에 갯수만큼 추가시킨다.
			       if (i == 0) {
			           sql.append("	AND	(						\r\n");
				   } else if ( i > 0) {
					   sql.append("	OR							\r\n");
				   }
			    			
			           sql.append("        YYYYMMDD            =   ?   \r\n");
			    			
			    		if (i == (arrStr.length - 1) ) {
			    				sql.append("	)	");
			    		}
			  }
			    		
			            /**************************************************************************/
			            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
			            /**************************************************************************/
			            
						pstmt 	= 	con.prepareStatement(sql.toString());
						
						/**************************************************************************/
						//P A R A M E T E R		V A L U E S		S T A R T
						/**************************************************************************/
			int idx = 1;
			System.out.println("LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL");
			//pstmt.setString(idx++ , listCondition.get(0));	//그룹코드//group_cd
			pstmt.setString(idx++ , listCondition.get(1));	//그룹코드//group_cd
			System.out.println("LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL");
			//pstmt.setString(idx++ , listCondition.get(2));	//그룹코드//group_cd
			pstmt.setString(idx++ , listCondition.get(3));	//그룹코드//group_cd
			System.out.println("LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL");
			for (int i = 0; i < arrStr.length ; i++) {
				pstmt.setString(idx++ , arrStr[i]);	//기준일자 				
			}
			System.out.println("LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL");
			
//			System.out.println("------------------------------------------------------\r\n");
//			System.out.println("휴가 입력 - 저장\r\n" + sql.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			//idx = 0;	//init
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			System.out.println("LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL");
			int i = pstmt.executeUpdate();
			System.out.println("LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL");
		
			System.out.println("update return value--------->>>>>>>>>>>>>>>>\r\n" + i);
			
			
			if (i >= 1) {
				//update가 적용된 row가 0 이하인 경우
				setMsg("변경 사유가 입력되었습니다.");
			} else {
				setMsg("변경 사유가 이미 입력되었거나 \r\n 입력되지 않았습니다.");
			}
			
			System.out.println(msg);
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
public void updateVacation(List<String> listCondition , String yyyymmdd, String vaca_in_out_tp) throws BaseException , SQLException {
	
    String inout = vaca_in_out_tp.substring(0,1);
	System.out.println("휴가업데이트 기준일자"+yyyymmdd);
	
	System.out.println(listCondition);
	
    System.out.println("updateVacation_vaca_in_out_tp---------->"+vaca_in_out_tp);
    System.out.println("updateVacation_vaca_in_out_tp---------->"+inout);
    con = super.getDataSource().getConnection();
	
	try {
		
		sql.setLength(0);
		
	    sql.append("    UPDATE                                                                                      \r\n");
		sql.append("            TB_ATTEND                                                                           \r\n");
		sql.append("    SET                                                                                         \r\n");
		sql.append("            IN_OUT_DETAIL       =   ?                                                           \r\n");
	    sql.append("        ,   IN_OUT_DT           =   CONVERT(VARCHAR(8) , GETDATE() , 112)                       \r\n");
	    sql.append("        ,   IN_OUT_TIME         =   REPLACE(CONVERT(VARCHAR(6) , GETDATE() , 108) , ':' , '')   \r\n");
		sql.append("        ,   ETC_EMP             =   ?                                                           \r\n");
		sql.append("        ,   REG_IP              =   ?                                                           \r\n");
	    sql.append("    WHERE   1   =   1                                                                           \r\n");
		sql.append("        AND EMP_NO    =    ?                                                                    \r\n");
		sql.append("        AND IN_OUT_TP = '"+ inout +"'                                                           \r\n");            
		            
		            
		 /**************************************************************************/
		//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
		/**************************************************************************/
		  String[] arrStr = yyyymmdd.split(",");
		            
		    //잘라서 담는다.
		    		
		    //갯수에 따라 뽑아지게 된다.
		   for (int i = 0; i < arrStr.length ; i++) {
		    	//SQL에 갯수만큼 추가시킨다.
		       if (i == 0) {
		           sql.append("	AND	(						\r\n");
			   } else if ( i > 0) {
				   sql.append("	OR							\r\n");
			   }
		    			
		           sql.append("        YYYYMMDD            =   ?   \r\n");
		    			
		    		if (i == (arrStr.length - 1) ) {
		    				sql.append("	)	");
		    		}
		  }
		    		
		            /**************************************************************************/
		            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
		            /**************************************************************************/
		            
					pstmt 	= 	con.prepareStatement(sql.toString());
					
					/**************************************************************************/
					//P A R A M E T E R		V A L U E S		S T A R T
					/**************************************************************************/
		int idx = 1;
		
		pstmt.setString(idx++ , listCondition.get(0));	//그룹코드//group_cd
		pstmt.setString(idx++ , listCondition.get(1));	//그룹코드//group_cd
		pstmt.setString(idx++ , listCondition.get(2));	//그룹코드//group_cd
		pstmt.setString(idx++ , listCondition.get(3));	//그룹코드//group_cd
		for (int i = 0; i < arrStr.length ; i++) {
			pstmt.setString(idx++ , arrStr[i]);	//기준일자 				
		}
		
		
//		System.out.println("------------------------------------------------------\r\n");
//		System.out.println("휴가 입력 - 저장\r\n" + sql.toString());
//		System.out.println("------------------------------------------------------\r\n");
		
		idx = 0;	//init
		
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		E   N   D
		/**************************************************************************/
		
		int i = pstmt.executeUpdate();
		
	
		System.out.println("update return value--------->>>>>>>>>>>>>>>>\r\n" + i);
		
		
		if (i >= 1) {
			//update가 적용된 row가 0 이하인 경우
			setMsg("휴가정보가 입력되었습니다.");
		} else {
			setMsg("휴가 정보가 이미 입력되었거나 \r\n 입력되지 않았습니다.");
		}
		
		System.out.println(msg);
		
	} catch (SQLException se) {
		se.printStackTrace();
		BaseException dex = new BaseException();                
		dex.setException(se);
		dex.setAppReturnCode("10");
		throw dex;
	} catch(Exception e) {
		BaseException dex = new BaseException();                
		dex.setException(e);
		dex.setAppReturnCode("20");
		throw dex;
	} finally {
		try {
			if (pstmt != null) pstmt.close();
			if (rs != null) rs.close();
			if(con != null) con.close();

		} catch(SQLException fse) {
			BaseException dex = new BaseException();                
			dex.setException(fse);
			dex.setAppReturnCode("10");
			throw dex;
		}          
	}
}
public void updateVacation2(List<String> listCondition , String yyyymmdd, String vaca_in_out_tp) throws BaseException , SQLException {
	
	
	
	System.out.println(yyyymmdd);
	
	System.out.println(listCondition);
	
    System.out.println("updateVacation_vaca_in_out_tp---------->"+vaca_in_out_tp);
	con = super.getDataSource().getConnection();
	      
	      
	try {
	  if(vaca_in_out_tp.equals("IO")){
		  
		 
		
		sql.setLength(0);

        sql.append("    UPDATE                                                                                      \r\n");
        sql.append("            TB_ATTEND                                                                           \r\n");
        sql.append("    SET                                                                                         \r\n");
        sql.append("            IN_OUT_DETAIL       =    ?                                                           \r\n");
        sql.append("        ,   IN_OUT_DT           =   CONVERT(VARCHAR(8) , GETDATE() , 112)                       \r\n");
        sql.append("        ,   IN_OUT_TIME         =   REPLACE(CONVERT(VARCHAR(6) , GETDATE() , 108) , ':' , '')   \r\n");
        sql.append("        ,   ETC_EMP             =    ?                                                          \r\n");
        sql.append("        ,   REG_IP              =    ?                                                          \r\n");
        sql.append("    WHERE                                                                                       \r\n");
        sql.append("       EMP_NO              =    ?                                                               \r\n");
        sql.append("        AND                                                                                     \r\n");	
        sql.append("            IN_OUT_TP IN ('I','O')                                                               \r\n");	
        //sql.append("        AND   YYYYMMDD            =   '"+ ymds1 +"'                                           \r\n");
       
		
        /**************************************************************************/
        //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
        /**************************************************************************/
        String[] ymds = yyyymmdd.split(",");
        for (int i = 0; i < ymds.length ; i=i+2) {
	    	//SQL에 갯수만큼 추가시킨다.
	       if (i == 0) {
	           sql.append("	AND	(						\r\n");
		   } else if ( i > 0) {
			   sql.append("	OR							\r\n");
		   }
	    			
	           sql.append("        YYYYMMDD            =   ?   \r\n");
	    			
	    		if (i == (ymds.length - 2) ) {
	    				sql.append("	)	");
	    		}
	  }
		pstmt 	= 	con.prepareStatement(sql.toString());
		
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		S T A R T
		/**************************************************************************/
		int idx = 1;
		
		pstmt.setString(idx++ , listCondition.get(0));	//그룹코드//group_cd
		pstmt.setString(idx++ , listCondition.get(1));	//그룹코드//group_cd
		pstmt.setString(idx++ , listCondition.get(2));	//그룹코드//group_cd
		pstmt.setString(idx++ , listCondition.get(3));	//그룹코드//group_cd
		for (int i = 0; i < ymds.length ; i=i+2) {
			pstmt.setString(idx++ , ymds[i]);	//기준일자 				
		}
		
		
//		System.out.println("------------------------------------------------------\r\n");
//		System.out.println("휴가 입력 - 저장\r\n" + sql.toString());
//		System.out.println("------------------------------------------------------\r\n");
		
		idx = 0;	//init
		
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		E   N   D
		/**************************************************************************/
		
		int i = pstmt.executeUpdate();
		
	
		System.out.println("update return value--------->>>>>>>>>>>>>>>>\r\n" + i);
		
		
		if (i >= 1) {
			//update가 적용된 row가 0 이하인 경우
			setMsg("퇴근유형 오후휴가정보가 입력되었습니다.");
		} else {
			setMsg("휴가 정보가 이미 입력되었거나 \r\n 입력되지 않았습니다.");
		}
		
		System.out.println(msg);
	  }
	} catch (SQLException se) {
		se.printStackTrace();
		BaseException dex = new BaseException();                
		dex.setException(se);
		dex.setAppReturnCode("10");
		throw dex;
	} catch(Exception e) {
		BaseException dex = new BaseException();                
		dex.setException(e);
		dex.setAppReturnCode("20");
		throw dex;
	} finally {
		try {
			if (pstmt != null) pstmt.close();
			if (rs != null) rs.close();
			if(con != null) con.close();

		} catch(SQLException fse) {
			BaseException dex = new BaseException();                
			dex.setException(fse);
			dex.setAppReturnCode("10");
			throw dex;
		}          
	}
}
	/**
	 * 출근정보가 이미 입력되었는지를 확인함.
	 * @param listCondition	-조건-
	 * @throws BaseException
	 */
	public void existCheckInInfo(List<String> listCondition) throws BaseException {
		
		try {
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("						SELECT 	COUNT(IN_OUT_DETAIL) CNT             							\n");
			sql.append("						FROM 	TB_ATTEND						     							\n");
			sql.append("						WHERE 	IN_OUT_TP 	= 'I'                    							\n");
			sql.append("						AND 	IN_OUT_DETAIL NOT IN ( 'XX' , '8003')							\n");
			sql.append("						AND 	YYYYMMDD 	= ?             							\n");
			sql.append("						AND 	EMP_NO = ?                         							\n");
			
            /*************************************************************************/
            //D	E	B	U	G										S	T	A	R	T
            /*************************************************************************/
//            System.out.println("--------------------출근입력 체크 쿼리-----------------------");
//            System.out.println(sql.toString());
            /*************************************************************************/
            //D	E	B	U	G										E		N		D
            /*************************************************************************/
            
            /**************************************************************************/
            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
            /**************************************************************************/
            
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			int idx = 1;
			
			pstmt.setString(idx++ , listCondition.get(0));					//
			pstmt.setInt(	idx++ , Integer.valueOf(listCondition.get(1)));	//
			//System.out.println(listCondition.get(0)+"개소문");
//			System.out.println("------------------------------------------------------\r\n");
//			System.out.println("출근정보가있는지 확인 쿼리	\r\n" + sql.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			idx = 0;	//init
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			if (rs.next()) {
				cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
			
				if (cnt > 0) {
					setChk_in_msg("출근정보가 이미 입력 되었습니다.");
				}
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * 출근정보가 이미 입력되었는지를 확인함.
	 * @param listCondition	-조건-
	 * @throws BaseException
	 */
	public void existCheckInInfo2(List<String> listCondition1) throws BaseException {
		
		try {
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("						SELECT 	COUNT(IN_OUT_DETAIL) CNT             							\n");
			sql.append("						FROM 	TB_ATTEND						     							\n");
			sql.append("						WHERE 	IN_OUT_TP 	= 'I'                    							\n");
			sql.append("						AND 	IN_OUT_DETAIL NOT IN ( 'XX' , '8003')							\n");
			sql.append("						AND 	YYYYMMDD 	= ?                                         	\n");
			sql.append("						AND 	EMP_NO = ?                         							\n");
			
            /*************************************************************************/
            //D	E	B	U	G										S	T	A	R	T
            /*************************************************************************/
//            System.out.println("--------------------출근입력 체크 쿼리-----------------------");
//            System.out.println(sql.toString());
            /*************************************************************************/
            //D	E	B	U	G										E		N		D
            /*************************************************************************/
            
            /**************************************************************************/
            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
            /**************************************************************************/
            
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			int idx = 1;
			
			pstmt.setString(idx++ , listCondition1.get(0));
			pstmt.setInt(	idx++ , Integer.valueOf(listCondition1.get(1)));	//
			
			System.out.println(listCondition1.get(0)+"개소문");
			System.out.println("------------------------------------------------------\r\n");
			System.out.println("출근정보가있는지 확인 쿼리	\r\n" + sql.toString());
			System.out.println("------------------------------------------------------\r\n");
			
			idx = 0;	//init
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			if (rs.next()) {
				cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
			
				if (cnt > 0) {
					setChk_in_msg("출근정보가 이미 입력 되었습니다.");
				}
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * 퇴근정보가 이미 입력되었는지를 확인함.
	 * @param listCondition	-조건-
	 * @throws BaseException
	 * @throws SQLException
	 */
public void existCheckOutInfo2(List<String> listCondition1) throws BaseException , SQLException {
		
		con = super.getDataSource().getConnection();
		
		try {
			
			sql.setLength(0);
			/*
			sql.append("    SELECT                                  \r\n");
			sql.append("    		COUNT(IN_OUT_DETAIL )	CNT     \r\n");
			sql.append("    FROM                                    \r\n");
			sql.append("    		TB_ATTEND                       \r\n");
			sql.append("    WHERE                                   \r\n");
			sql.append("    	 EXISTS                             \r\n");
			sql.append("    		(                               \r\n");
			sql.append("    			SELECT                      \r\n");
			sql.append("    					IN_OUT_DETAIL       \r\n");
			sql.append("    				,	IN_OUT_DT           \r\n");
			sql.append("    				,	IN_OUT_TIME         \r\n");
			sql.append("    			FROM                        \r\n");
			sql.append("    					TB_ATTEND           \r\n");
			sql.append("    			WHERE                       \r\n");
			sql.append("						#1					\r\n");
			sql.append("    		)                               \r\n");
			sql.append("		AND									\r\n");
			sql.append("		#2									\r\n");
			*/
			
			sql.append("						SELECT 	COUNT(IN_OUT_DETAIL) CNT             							\n");
			sql.append("						FROM 	TB_ATTEND						     							\n");
			sql.append("						WHERE 	IN_OUT_TP 	= 'O'                    							\n");
			sql.append("						AND 	IN_OUT_DETAIL NOT IN ( 'XX' , '8003')							\n");
			sql.append("						AND 	YYYYMMDD 	= ?                                                 \n");
			sql.append("						AND 	EMP_NO = ?                         							     \n");
			
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
			/*
			//쿼리에서 중복제거를 위함.
			StringBuilder sb = new StringBuilder(0);
			
			sb.append("    					YYYYMMDD	=	?   		\r\n");
			sb.append("    				AND	                    		\r\n");
			sb.append("    					EMP_NO		=	?   		\r\n");
			sb.append("    				AND	                    		\r\n");
			sb.append("    					IN_OUT_TP	=	'O' 		\r\n");
			sb.append("    				AND	                    		\r\n");
	        sb.append("    					IN_OUT_DETAIL 	!= 	'XX' 	\r\n");
	        sb.append("    				AND CONFIRM_YN 		= 'Y'		\r\n");
	            
			//#1 , #2 치환
			String s = sql.toString();
			
			s = s.replaceAll("#1", sb.toString());	//#1을 치환함.
			s = s.replaceAll("#2", sb.toString());	//#2를 치환함.
			
			sb = null;	//GC
			*/
			/*************************************************************************/
            //D	E	B	U	G										S	T	A	R	T
            /*************************************************************************/
//            System.out.println("--------------------퇴근입력 체크 쿼리-----------------------");
//            System.out.println(sql.toString());
            /*************************************************************************/
            //D	E	B	U	G										E		N		D
            /*************************************************************************/
            
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
			/**************************************************************************/
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			int idx = 1;
			
			pstmt.setString(idx++ , listCondition1.get(0));					//
			pstmt.setInt(	idx++ , Integer.valueOf(listCondition1.get(1)));	//
			
//			System.out.println("------------------------------------------------------\r\n");
//			System.out.println("퇴근정보가있는지 확인 쿼리	\r\n" + sql.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			idx = 0;	//init
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			if (rs.next()) {
				cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
				
				if (cnt >= 1) {
					setChk_out_msg("퇴근정보가 이미 입력 되었습니다.");
				}
			}
			
//			for (String ss : listCondition) {
//				System.out.println("@@@@@@-------------listCondition------------@@@@@@@@@		" + ss);
//			}
			
			//System.out.println("chk_in_msgchk_in_msgchk_in_msg------->>>>>>>>>		" + chk_in_msg);
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	public void existCheckOutInfo(List<String> listCondition) throws BaseException , SQLException {
		
		con = super.getDataSource().getConnection();
		
		try {
			
			sql.setLength(0);
			/*
			sql.append("    SELECT                                  \r\n");
			sql.append("    		COUNT(IN_OUT_DETAIL )	CNT     \r\n");
			sql.append("    FROM                                    \r\n");
			sql.append("    		TB_ATTEND                       \r\n");
			sql.append("    WHERE                                   \r\n");
			sql.append("    	 EXISTS                             \r\n");
			sql.append("    		(                               \r\n");
			sql.append("    			SELECT                      \r\n");
			sql.append("    					IN_OUT_DETAIL       \r\n");
			sql.append("    				,	IN_OUT_DT           \r\n");
			sql.append("    				,	IN_OUT_TIME         \r\n");
			sql.append("    			FROM                        \r\n");
			sql.append("    					TB_ATTEND           \r\n");
			sql.append("    			WHERE                       \r\n");
			sql.append("						#1					\r\n");
			sql.append("    		)                               \r\n");
			sql.append("		AND									\r\n");
			sql.append("		#2									\r\n");
			*/
			
			sql.append("						SELECT 	COUNT(IN_OUT_DETAIL) CNT             							\n");
			sql.append("						FROM 	TB_ATTEND						     							\n");
			sql.append("						WHERE 	IN_OUT_TP 	= 'O'                    							\n");
			sql.append("						AND 	IN_OUT_DETAIL NOT IN ( 'XX' , '8003')							\n");
			sql.append("						AND 	YYYYMMDD 	= ?             							\n");
			sql.append("						AND 	EMP_NO = ?                         							\n");
			
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
			/*
			//쿼리에서 중복제거를 위함.
			StringBuilder sb = new StringBuilder(0);
			
			sb.append("    					YYYYMMDD	=	?   		\r\n");
			sb.append("    				AND	                    		\r\n");
			sb.append("    					EMP_NO		=	?   		\r\n");
			sb.append("    				AND	                    		\r\n");
			sb.append("    					IN_OUT_TP	=	'O' 		\r\n");
			sb.append("    				AND	                    		\r\n");
	        sb.append("    					IN_OUT_DETAIL 	!= 	'XX' 	\r\n");
	        sb.append("    				AND CONFIRM_YN 		= 'Y'		\r\n");
	            
			//#1 , #2 치환
			String s = sql.toString();
			
			s = s.replaceAll("#1", sb.toString());	//#1을 치환함.
			s = s.replaceAll("#2", sb.toString());	//#2를 치환함.
			
			sb = null;	//GC
			*/
			/*************************************************************************/
            //D	E	B	U	G										S	T	A	R	T
            /*************************************************************************/
//            System.out.println("--------------------퇴근입력 체크 쿼리-----------------------");
//            System.out.println(sql.toString());
            /*************************************************************************/
            //D	E	B	U	G										E		N		D
            /*************************************************************************/
            
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
			/**************************************************************************/
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			int idx = 1;
			
			pstmt.setString(idx++ , listCondition.get(0));					//
			pstmt.setInt(	idx++ , Integer.valueOf(listCondition.get(1)));	//
			
//			System.out.println("------------------------------------------------------\r\n");
//			System.out.println("퇴근정보가있는지 확인 쿼리	\r\n" + sql.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			idx = 0;	//init
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			if (rs.next()) {
				cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
				
				if (cnt > 0) {
					setChk_out_msg("퇴근정보가 이미 입력 되었습니다.");
				}
			}
			
//			for (String ss : listCondition) {
//				System.out.println("@@@@@@-------------listCondition------------@@@@@@@@@		" + ss);
//			}
			
			System.out.println("chk_in_msgchk_in_msgchk_in_msg------->>>>>>>>>		" + chk_in_msg);
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}

	/**
	 * @param yyyymmdds
	 * @param emp_no
	 * @throws BaseException
	 * @throws SQLException
	 */
/**
 */
	public void existCheckInInfoByVaca(String vaca_in_out_tp,String yyyymmdds , int emp_no) throws BaseException , SQLException {
		System.out.println("yyyymmdds-------11234>>>>>>>>>>>>"+yyyymmdds);
		if (yyyymmdds == null) {
			System.out.println("yyyymmdds is ---->       null333입니다.");
			return;
		}
		
		System.out.println("vaca_in_out_tp--------"+vaca_in_out_tp);
		con = super.getDataSource().getConnection();
		
		try {
			//System.out.print("inOUt"+inOut.equals("O"));
			
		 if(vaca_in_out_tp.equals("I")){
			sql.setLength(0);

			sql.append("    	SELECT                              					\r\n");
            sql.append("    			COUNT(*) CNT    								\r\n");
            sql.append("    	FROM	TB_ATTEND                   					\r\n");
            sql.append("    	WHERE                               					\r\n");
            sql.append("    			EMP_NO = " + emp_no + "     					\r\n");
            sql.append("    		AND IN_OUT_TP IN ('I')         					    \r\n");
            sql.append("    		AND IN_OUT_DETAIL NOT IN ( '2001','2002','2003','2004','2005','XX'       \r\n");
            sql.append("     ,'0007','0008','0009','0004','0005','1009','1010','1011','1006','1007')         \r\n");
            sql.append("    		AND	YYYYMMDD  IN ( #1)          					\r\n");
            
            /**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
           
            
            String s = sql.toString();
            
            sql.setLength(0);
            sql = null;
            
            s = s.replaceAll("#1", yyyymmdds);	//#1을 치환함.
            
            /**************************************************************************/
            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
            /**************************************************************************/
            
			pstmt 	= 	con.prepareStatement(s.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			
//			System.out.println("------------------------------------------------------\r\n");
//			System.out.println("출근정보가있는지 확인 쿼리	\r\n" + s.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			if (rs.next()) {
				cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
			
				if (cnt > 0) {
					setChk_in_msg("출근정보가 이미 입력 되었습니다.");
					setMsg(" 휴가유형 이외의 출퇴근 정보가 있는 행이 선택 되었습니다. 다시 선택하여 주시기 바랍니다.");
				} else {
					setMsg(CodeMetrix.OK);
				}
			}
			
			//System.out.println("CNTCNTCNTCNTCNTCNTCNTCNTCNTCNT------->>>>>>>>>		" + cnt);
			//System.out.println("chk_in_msgchk_in_msgchk_in_msg------->>>>>>>>>		" + msg);
		  }
		  if(vaca_in_out_tp.equals("O")){
			sql.setLength(0);

			sql.append("    	SELECT                              					\r\n");
            sql.append("    			COUNT(*) CNT    								\r\n");
            sql.append("    	FROM	TB_ATTEND                   					\r\n");
            sql.append("    	WHERE                               					\r\n");
            sql.append("    			EMP_NO = " + emp_no + "     					\r\n");
            sql.append("    		AND IN_OUT_TP IN ('O')         					\r\n");
            sql.append("    		AND IN_OUT_DETAIL NOT IN ( '2001','2002','2003','2004','2005','XX'       \r\n");
            sql.append("     ,'0007','0008','0009','0004','0005','1009','1010','1011','1006','1007') \r\n");
            sql.append("    		AND	YYYYMMDD IN ( #1 )          					\r\n");
            
            /**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
            
            //#1 치환
            String s = sql.toString();
            
            sql.setLength(0);
            sql = null;
            
            s = s.replaceAll("#1", yyyymmdds);	//#1을 치환함.
            
            /**************************************************************************/
            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
            /**************************************************************************/
            
			pstmt 	= 	con.prepareStatement(s.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			
//			System.out.println("------------------------------------------------------\r\n");
//			System.out.println("출근정보가있는지 확인 쿼리	\r\n" + s.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			if (rs.next()) {
				cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
			
				if (cnt > 0) {
					setChk_in_msg("출근정보가 이미 입력 되었습니다.");
					setMsg(" 휴가유형 이외의 출퇴근 정보가 있는 행이 선택 되었습니다. 다시 선택하여 주시기 바랍니다.");
				} else {
					setMsg(CodeMetrix.OK);
				}
			}
		  }
		  if(vaca_in_out_tp.equals("IO")){
			             
				sql.setLength(0);

				sql.append("    	SELECT                              					                     \r\n");
	            sql.append("    			COUNT(*) CNT    								                     \r\n");
	            sql.append("    	FROM	TB_ATTEND                   					                     \r\n");
	            sql.append("    	WHERE                               					                     \r\n");
	            sql.append("    			EMP_NO = " + emp_no + "     					                     \r\n");
	            sql.append("    		AND IN_OUT_TP IN ('I','O')         					                     \r\n");
	            sql.append("    		AND IN_OUT_DETAIL NOT IN ( '2001','2002','2003','2004','2005','XX'       \r\n");
	            sql.append("     ,'0007','0008','0009','0004','0005','1009','1010','1011','1006','1007')         \r\n");
	            sql.append("    		AND	YYYYMMDD   IN ( #1 )          					                 \r\n");
	            
	            /**************************************************************************/
				//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
				/**************************************************************************/
	            
	            //#1 치환
	            String s = sql.toString();
	            
	            sql.setLength(0);
	            sql = null;
	            
	            s = s.replaceAll("#1", yyyymmdds);	//#1을 치환함.
	            
	            /**************************************************************************/
	            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
	            /**************************************************************************/
	            
				pstmt 	= 	con.prepareStatement(s.toString());
				
				/**************************************************************************/
				//P A R A M E T E R		V A L U E S		S T A R T
				/**************************************************************************/
				
				System.out.println("------------------------------------------------------\r\n");
				System.out.println("아아아아	\r\n" + s.toString());
				System.out.println("------------------------------------------------------\r\n");
				
				/**************************************************************************/
				//P A R A M E T E R		V A L U E S		E   N   D
				/**************************************************************************/
				
				rs = pstmt.executeQuery();
				
				boolean f = false;
				String[] ymds = yyyymmdds.split(","); //기준일자를 체크한 개수
				int count=0;
				int tr=0;
				//int fa=0;
				for(int i=0; i<ymds.length; i++){
					count++;
					
				}

				if(count%2==1){             //일일휴가 입력에서 기준일자가 홀수개수가 들어오면 입력이 되지 않는다.
					f=true;
				//System.out.println("ffffff----------------------------------------------"+f);	
				}
				
				
                if(count%2==0){
			      for(int i=0; i<ymds.length; i=i+2){
				    if(ymds[i].equals(ymds[i+1])==true){
					     tr++;
					     //System.out.println("tr--------"+tr);
				     }
//				    
			      }
                }
                if(tr!=count/2){           //선택한 기준일자 반의 개수와 비교한 값 개수가 같아야 한다.
                	f=true;
                	//System.out.println("fffffff111-----------------"+f);
                }
                
				if (rs.next()) {
					cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
				
					if (cnt > 0 || f) {
						setChk_in_msg("기준일자가 다른 출근,퇴근행은 따로 실행하여 주시기 바랍니다.");
						setMsg("출퇴근행은 구별하여야 다중 선택이 가능하며,일일휴가는 출퇴근행을 동시에 체크해 주시기 바랍니다.");
					} else {
						setMsg(CodeMetrix.OK);
					}
				 }
			   
			  }
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
		
	}
	public void existCheckInInfoByVaca1(String vaca_in_out_tp,String yyyymmdds , int emp_no) throws BaseException , SQLException {
		System.out.println("yyyymmdds-------11234>>>>>>>>>>>>"+yyyymmdds);
		if (yyyymmdds == null) {
			System.out.println("yyyymmdds is ---->       null333입니다.");
			return;
		}
		
		System.out.println("vaca_in_out_tp--------"+vaca_in_out_tp);
		con = super.getDataSource().getConnection();
		
		try {
			//System.out.print("inOUt"+inOut.equals("O"));
			
		 if(vaca_in_out_tp.equals("I")){
			sql.setLength(0);

			sql.append("    	SELECT                              					\r\n");
            sql.append("    			COUNT(*) CNT    								\r\n");
            sql.append("    	FROM	TB_ATTEND                   					\r\n");
            sql.append("    	WHERE                               					\r\n");
            sql.append("    			EMP_NO = " + emp_no + "     					\r\n");
            sql.append("    		AND IN_OUT_TP IN ('I')         					    \r\n");
            sql.append("    		AND IN_OUT_DETAIL NOT IN ( '2001','2002','2003','2004','2005','XX'       \r\n");
            sql.append("     ,'0007','0008','0009','0004','0005','1009','1010','1011','1006','1007')         \r\n");
            sql.append("    		AND	YYYYMMDD  IN ( #1)          					\r\n");
            
            /**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
           
            
            String s = sql.toString();
            
            sql.setLength(0);
            sql = null;
            
            s = s.replaceAll("#1", yyyymmdds);	//#1을 치환함.
            
            /**************************************************************************/
            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
            /**************************************************************************/
            
			pstmt 	= 	con.prepareStatement(s.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			
//			System.out.println("------------------------------------------------------\r\n");
//			System.out.println("출근정보가있는지 확인 쿼리	\r\n" + s.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			if (rs.next()) {
				cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
			
				if (cnt > 0) {
					setChk_in_msg("출근정보가 이미 입력 되었습니다.");
					setMsg(" 퇴근유형이 오후휴가 경우에만 선택이 가능합니다 . 다시 선택하여 주시기 바랍니다.");
				} else {
					setMsg(CodeMetrix.OK);
				}
			}
			
			//System.out.println("CNTCNTCNTCNTCNTCNTCNTCNTCNTCNT------->>>>>>>>>		" + cnt);
			//System.out.println("chk_in_msgchk_in_msgchk_in_msg------->>>>>>>>>		" + msg);
		  }
		  if(vaca_in_out_tp.equals("O")){
			sql.setLength(0);

			sql.append("    	SELECT                              					\r\n");
            sql.append("    			COUNT(*) CNT    								\r\n");
            sql.append("    	FROM	TB_ATTEND                   					\r\n");
            sql.append("    	WHERE                               					\r\n");
            sql.append("    			EMP_NO = " + emp_no + "     					\r\n");
            sql.append("    		AND IN_OUT_TP IN ('O')         					\r\n");
            sql.append("    		AND IN_OUT_DETAIL NOT IN ( '2001','2002','2003','2004','2005','XX'       \r\n");
            sql.append("     ,'0007','0008','0009','0004','0005','1009','1010','1011','1006','1007') \r\n");
            sql.append("    		AND	YYYYMMDD IN ( #1 )          					\r\n");
            
            /**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
            
            //#1 치환
            String s = sql.toString();
            
            sql.setLength(0);
            sql = null;
            
            s = s.replaceAll("#1", yyyymmdds);	//#1을 치환함.
            
            /**************************************************************************/
            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
            /**************************************************************************/
            
			pstmt 	= 	con.prepareStatement(s.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			
//			System.out.println("------------------------------------------------------\r\n");
//			System.out.println("출근정보가있는지 확인 쿼리	\r\n" + s.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			if (rs.next()) {
				cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
			
				if (cnt > 0) {
					setChk_in_msg("출근정보가 이미 입력 되었습니다.");
					setMsg(" 퇴근유형이 오후휴가 경우에만 선택이 가능합니다 . 다시 선택하여 주시기 바랍니다.");
				} else {
					setMsg(CodeMetrix.OK);
				}
			}
		  }
		  if(vaca_in_out_tp.equals("IO")){
			             
				sql.setLength(0);

				sql.append("    	SELECT                              					                     \r\n");
	            sql.append("    			COUNT(*) CNT    								                     \r\n");
	            sql.append("    	FROM	TB_ATTEND                   					                     \r\n");
	            sql.append("    	WHERE                               					                     \r\n");
	            sql.append("    			EMP_NO = " + emp_no + "     					                     \r\n");
	            sql.append("    		AND IN_OUT_TP IN ('I','O')         					                     \r\n");
	            sql.append("    		AND IN_OUT_DETAIL NOT IN ( '2001','2002','2003','2004','2005','XX'       \r\n");
	            sql.append("     ,'0007','0008','0009','0004','0005','1009','1010','1011','1006','1007')         \r\n");
	            sql.append("    		AND	YYYYMMDD   IN ( #1 )          					                 \r\n");
	            
	            /**************************************************************************/
				//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
				/**************************************************************************/
	            
	            //#1 치환
	            String s = sql.toString();
	            
	            sql.setLength(0);
	            sql = null;
	            
	            s = s.replaceAll("#1", yyyymmdds);	//#1을 치환함.
	            
	            /**************************************************************************/
	            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
	            /**************************************************************************/
	            
				pstmt 	= 	con.prepareStatement(s.toString());
				
				/**************************************************************************/
				//P A R A M E T E R		V A L U E S		S T A R T
				/**************************************************************************/
				
				System.out.println("------------------------------------------------------\r\n");
				System.out.println("아아아아	\r\n" + s.toString());
				System.out.println("------------------------------------------------------\r\n");
				
				/**************************************************************************/
				//P A R A M E T E R		V A L U E S		E   N   D
				/**************************************************************************/
				
				rs = pstmt.executeQuery();
				
				boolean f = false;
				String[] ymds = yyyymmdds.split(","); //기준일자를 체크한 개수
				int count=0;
				int tr=0;
				//int fa=0;
				for(int i=0; i<ymds.length; i++){
					count++;
					
				}

				if(count%2==1){             //일일휴가 입력에서 기준일자가 홀수개수가 들어오면 입력이 되지 않는다.
					f=true;
				//System.out.println("ffffff----------------------------------------------"+f);	
				}
				
				
                if(count%2==0){
			      for(int i=0; i<ymds.length; i=i+2){
				    if(ymds[i].equals(ymds[i+1])==true){
					     tr++;
					     //System.out.println("tr--------"+tr);
				     }
//				    
			      }
                }
                if(tr!=count/2){           //선택한 기준일자 반의 개수와 비교한 값 개수가 같아야 한다.
                	f=true;
                	//System.out.println("fffffff111-----------------"+f);
                }
                
				if (rs.next()) {
					cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
				
					if (cnt > 0 || f) {
						setChk_in_msg("기준일자가 다른 출근,퇴근행은 따로 실행하여 주시기 바랍니다.");
						setMsg("퇴근유형이 오후휴가 경우에만 선택이 가능합니다 .다시 선택하여 주시기 바랍니다.");
					} else {
						setMsg(CodeMetrix.OK);
					}
				 }
			   
			  }
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
		
	}



//public void existCheckInInfoByVaca(String vaca_in_out_tp ,String yyyymmdds , int emp_no) throws BaseException , SQLException {
//		System.out.println("vaca_in_out치환-----"+vaca_in_out_tp);
//		if (yyyymmdds == null) {
//			System.out.println("yyyymmdds is ---->       null222입니다.");
//			return;
//		}
//		
//		
//		
//		con = super.getDataSource().getConnection();
//		
//		try {
//			
//			sql.setLength(0);
//
//			sql.append("    	SELECT                              					\r\n");
//            sql.append("    			COUNT(*) CNT    								\r\n");
//            sql.append("    	FROM	TB_ATTEND                   					\r\n");
//            sql.append("    	WHERE                               					\r\n");
//            sql.append("    			EMP_NO = " + emp_no + "     					\r\n");
//            //sql.append("    		AND IN_OUT_TP IN ( 'I','O' )         					\r\n");
//            sql.append("    		AND IN_OUT_DETAIL NOT IN ( '2001','2002','2003','2004','2005','XX'       \r\n");
//            sql.append("     ,'0007','0008','0009','0004','0005','1009','1010','1011','1006','1007') \r\n");
//            sql.append("    		AND	YYYYMMDD IN ( #1 )          					\r\n");
//            /**************************************************************************/
//			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
//			/**************************************************************************/
//          
//            
//            
//
//            //#1 , #2 치환
//            String s = sql.toString();
//            
//            sql.setLength(0);
//            sql = null;
//            
//            	//#1을 치환함.
//            s = s.replaceAll("#1", yyyymmdds );
//            /**************************************************************************/
//            //D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
//            /**************************************************************************/
//            
//			pstmt 	= 	con.prepareStatement(s.toString());
//			
//			/**************************************************************************/
//			//P A R A M E T E R		V A L U E S		S T A R T
//			/**************************************************************************/
//			
////			System.out.println("------------------------------------------------------\r\n");
////			System.out.println("출근정보가있는지 확인 쿼리	\r\n" + s.toString());
////			System.out.println("------------------------------------------------------\r\n");
//			
//			/**************************************************************************/
//			//P A R A M E T E R		V A L U E S		E   N   D
//			/**************************************************************************/
//			
//			rs = pstmt.executeQuery();
//			
//			if (rs.next()) {
//				cnt = rs.getInt("CNT");	//cnt가 1이면 출근정보가 있는 것이다.
//			
//				if (cnt > 0) {
//					setChk_in_msg("출근정보가 이미 입력 되었습니다.");
//					setMsg("공휴일이거나 휴가정보 이외의 출퇴근 정보가 있는 행이 선택 되었습니다. 다시 선택하여 주시기 바랍니다.");
//				} else {
//					setMsg(CodeMetrix.OK);
//				}
//			}
//			
//			//System.out.println("CNTCNTCNTCNTCNTCNTCNTCNTCNTCNT------->>>>>>>>>		" + cnt);
//			//System.out.println("chk_in_msgchk_in_msgchk_in_msg------->>>>>>>>>		" + msg);
//			
//		} catch (SQLException se) {
//			se.printStackTrace();
//			BaseException dex = new BaseException();                
//			dex.setException(se);
//			dex.setAppReturnCode("10");
//			throw dex;
//		} catch(Exception e) {
//			BaseException dex = new BaseException();                
//			dex.setException(e);
//			dex.setAppReturnCode("20");
//			throw dex;
//		} finally {
//			try {
//				if (pstmt != null) pstmt.close();
//				if (rs != null) rs.close();
//				if(con != null) con.close();
//
//			} catch(SQLException fse) {
//				BaseException dex = new BaseException();                
//				dex.setException(fse);
//				dex.setAppReturnCode("10");
//				throw dex;
//			}          
//		}
//		
//	} 
	/**
	 * @param yyyymmdds
	 * @param emp_no
	 * @throws BaseException
	 * @throws SQLException
	 */
	public void vacaMsg(String vaca_in_out_tp, String yyyymmdds , int emp_no) throws BaseException , SQLException {
		
		//이상하게  sql로 할려고 했더니 오류남.
		StringBuffer 		vacaSql 	= 	new StringBuffer();
		
		if (yyyymmdds == null) {
			System.out.println("yyyymmdds is ---->       null111입니다.");
			return;
		}
		System.out.println("yyyymmdds is 78---->  " + yyyymmdds);
		System.out.println("vaca_in_out_tp78 ---->  " + vaca_in_out_tp);
		
		con = super.getDataSource().getConnection();
		
		try {
	      if(vaca_in_out_tp.equals("I")||vaca_in_out_tp.equals("O")){
			vacaSql.setLength(0);

			vacaSql.append("    	SELECT TOP 1                             			    \r\n");
			vacaSql.append("    			ETC_EMP    								        \r\n");
			vacaSql.append("    	FROM	TB_ATTEND                   					\r\n");
			vacaSql.append("    	WHERE                               					\r\n");
			vacaSql.append("    			EMP_NO = " + emp_no + "     					\r\n");
			//vacaSql.append("    		AND IN_OUT_TP IN ('I','O')         					\r\n");
			vacaSql.append("    		AND IN_OUT_TP = '" + vaca_in_out_tp + "'        					\r\n");
			vacaSql.append("    		AND IN_OUT_DETAIL IN ( '2001','2002','2003','2004','2005','XX'       \r\n");
			vacaSql.append("  ,'0007','0008','0009','0004','0005','1009','1010','1011','1006','1007')   \r\n");
			vacaSql.append("    		AND	YYYYMMDD IN ( " + yyyymmdds + " )          					\r\n");
            
			pstmt 	= 	con.prepareStatement(vacaSql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			
			//System.out.println("------------------------------------------------------\r\n");
			//System.out.println("입력자 비고값 확인 쿼리	\r\n" + vacaSql.toString());
			//System.out.println("------------------------------------------------------\r\n");
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			if (rs.next()) {
				etc_emp = rs.getString("ETC_EMP");
				setEtc_emp(etc_emp);
				System.out.println("etc_emp : "+etc_emp);
			}
	      }
		if(vaca_in_out_tp.equals("IO")){	
			vacaSql.setLength(0);

			vacaSql.append("    	SELECT TOP 1                             			    \r\n");
			vacaSql.append("    			ETC_EMP    								        \r\n");
			vacaSql.append("    	FROM	TB_ATTEND                   					\r\n");
			vacaSql.append("    	WHERE                               					\r\n");
			vacaSql.append("    			EMP_NO = " + emp_no + "     					\r\n");
			vacaSql.append("    		AND IN_OUT_TP = 'I'         					\r\n");
			//vacaSql.append("    		AND IN_OUT_TP = '" + vaca_in_out_tp + "'        					\r\n");
			vacaSql.append("    		AND IN_OUT_DETAIL IN ( '2001','2002','2003','2004','2005','XX'       \r\n");
			vacaSql.append("  ,'0007','0008','0009','0004','0005','1009','1010','1011','1006','1007')   \r\n");
			vacaSql.append("    		AND	YYYYMMDD IN ( " + yyyymmdds + " )          					\r\n");
            
			pstmt 	= 	con.prepareStatement(vacaSql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			
			//System.out.println("------------------------------------------------------\r\n");
			//System.out.println("입력자 비고값 확인 쿼리	\r\n" + vacaSql.toString());
			//System.out.println("------------------------------------------------------\r\n");
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			if (rs.next()) {
				etc_emp = rs.getString("ETC_EMP");
				setEtc_emp(etc_emp);
				System.out.println("etc_emp : "+etc_emp);
			}
		  }
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>
	 * 기준일자와 현재날짜가 같은지 확인 
	 * </pre>
	 * @throws BaseException
	 */
	public String hasYYYYMMDD() throws BaseException {
		
		try {
			
			con = getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("		SELECT	                                                               			\n");
			sql.append("				COUNT(*)        CNT                                               		\n");
			sql.append("		FROM	                                                               			\n");
			sql.append("				TB_ATTEND                                                      			\n");
			sql.append("		WHERE	                                                               			\n");
			sql.append("				YYYYMMDD	=	( SELECT CONVERT(VARCHAR , (GETDATE() ), 112) )			\n");
			sql.append("		AND		IN_OUT_TP 	= 	'I'														\n");
			
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
			/**************************************************************************/
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			
//			System.out.println("------------------------------------------------------\r\n");
//			System.out.println("기준일자와 현재날짜가 같은지 확인	\r\n" + sql.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
			int idx = 0;
			
			if (rs.next()) {
				idx = rs.getInt("CNT");
			}
			
			if (idx == 0 || idx < 0) {
				setMsg(CodeMetrix.FAILE);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
		return msg;
	}
	
public void retrieveIn(String reqInOutTp) throws BaseException , SQLException {
	System.out.println("reqInOutTp----------------------------"+reqInOutTp);
		try {
		  if(reqInOutTp.equals("I")){
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("		    SELECT CD, CD_NM FROM TB_COMM_CD       \n");
			sql.append("			WHERE GROUP_CD IN ( '100', '102')	   \n");
			sql.append("		     AND CD != '0'                         \n");
			sql.append("			 AND CD != '0002'	                   \n");
			sql.append("			 AND CD != '0006'                      \n");
			
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
			/**************************************************************************/
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			
//			System.out.println("------------------------------------------------------\r\n");
			System.out.println("  요청변경 쿼리	\r\n" + sql.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
           list = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd"             , rs.getString("CD") );
				hm.put("cd_nm"      	, rs.getString("CD_NM") );
				
				list.add(hm);
			}
		 
		  }
		 
		 if(reqInOutTp.equals("O")){ 
		  con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("		    SELECT CD,CD_NM FROM TB_COMM_CD       \n");
			sql.append("			WHERE GROUP_CD IN( '101')	          \n");
			sql.append("		     AND CD != '0'                        \n");
			sql.append("			 AND CD !='1008'                      \n");
			
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
			/**************************************************************************/
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			
//			System.out.println("------------------------------------------------------\r\n");
			System.out.println("  요청변경 쿼리	\r\n" + sql.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
         list = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd"               , rs.getString("CD") );
				hm.put("cd_nm"      	, rs.getString("CD_NM") );
				
				list.add(hm);
			}
		 }
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
		
	}
public void retrieveAuth(int emp_no) throws BaseException , SQLException {
	System.out.println("emp_no----------------------------"+emp_no);
		try {
		 
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append(" SELECT EEE.EMP_NO, EEE.EMP_NM                                                                   \n");
			sql.append(" FROM TB_EMP AS EEE JOIN                                                                         \n");
			sql.append(" (SELECT EMP_NO FROM TB_AUTH_DEPT AS A JOIN                                                      \n");
			sql.append(" (SELECT FK_DEPT_NO, D.DEPT_NO FROM TB_EMP AS EE                                                 \n");
			sql.append(" JOIN TB_DEPT D ON EE.FK_DEPT_NO = D.DEPT_NO AND USE_YN='Y' AND EE.EMP_NO=" + emp_no + "  ) AS EED    \n");
			sql.append(" ON A.DEPT_NO = EED.FK_DEPT_NO AND A.APPROV_YN='Y') AS EA                                        \n");
			sql.append(" ON EEE.EMP_NO = EA.EMP_NO ORDER BY EMP_NO                                                       \n");
			
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		S T A R T
			/**************************************************************************/
			/**************************************************************************/
			//D Y N A M I C	 P A R A M E T E R	 A D D M E N T		E   N   D
			/**************************************************************************/
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			
//			System.out.println("------------------------------------------------------\r\n");
			System.out.println("  쿼리	\r\n" + sql.toString());
//			System.out.println("------------------------------------------------------\r\n");
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs = pstmt.executeQuery();
			
           listAuth = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("emp_no"               , rs.getString("EMP_NO") );
				hm.put("emp_nm"      	      , rs.getString("EMP_NM") );
				
				listAuth.add(hm);
			}
		   
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
		
	}


	/************************** GETTER / SETTER START *****************************/
	
	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	public List<HashMap<String, String>> getList() {
		return list;
	}

	public void setList(List<HashMap<String, String>> list) {
		this.list = list;
	}

	public List<String> getListCondition() {
		return listCondition;
	}

	public void setListCondition(List<String> listCondition) {
		this.listCondition = listCondition;
	}
	
	//휴가입력에서 갯수에 따라 다르게 저장됨. 20090120,20090121,20090122
	public void setYyyymmdd(String yyyymmdd) {
		this.yyyymmdd = yyyymmdd;
	}

	public String getYyyymmdd() {
		return yyyymmdd;
	}

	public String getChk_in_msg() {
		return chk_in_msg;
	}

	public void setChk_in_msg(String chk_in_msg) {
		this.chk_in_msg = chk_in_msg;
	}

	public String getChk_out_msg() {
		return chk_out_msg;
	}

	public void setChk_out_msg(String chk_out_msg) {
		this.chk_out_msg = chk_out_msg;
	}

	public int getRowCount() {
		return rowCount;
	}

	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}

	public String getEtc_emp() {
		return etc_emp;
	}

	public void setEtc_emp(String etcEmp) {
		etc_emp = etcEmp;
	}

	public String getVaca_in_out_tp() {
		return vaca_in_out_tp;
	}

	public void setVaca_in_out_tp(String vacaInOutTp) {
		vaca_in_out_tp = vacaInOutTp;
	}

	public void setReqInOutTp(String reqInOutTp) {
		this.reqInOutTp = reqInOutTp;
	}

	public String getReqInOutTp() {
		return reqInOutTp;
	}

	public void setListAuth(List<HashMap<String,String>> listAuth) {
		this.listAuth = listAuth;
	}

	public List<HashMap<String,String>> getListAuth() {
		return listAuth;
	}

	public String getReqYyyymmdd() {
		return reqYyyymmdd;
	}

	public void setReqYyyymmdd(String reqYyyymmdd) {
		this.reqYyyymmdd = reqYyyymmdd;
	}

	public String getReq_etc() {
		return req_etc;
	}

	public void setReq_etc(String reqEtc) {
		req_etc = reqEtc;
	}

	public String getAuthConfirm() {
		return authConfirm;
	}

	public void setAuthConfirm(String authConfirm) {
		this.authConfirm = authConfirm;
	}

	public String getChangeAttendDo() {
		return changeAttendDo;
	}

	public void setChangeAttendDo(String changeAttendDo) {
		this.changeAttendDo = changeAttendDo;
	}

	public String getReqYmd() {
		return reqYmd;
	}

	public void setReqYmd(String reqYmd) {
		this.reqYmd = reqYmd;
	}


	/************************** GETTER / SETTER E N D ******************************/
}
